I've got a spreadsheet that looks at 14 day ATR, equity dedicated to a particular instrument, and instrument tick size. It then calculates your position size (# contracts) based on the time frame you are trading.
Let me clean it up and I'll post it here later today.
Well, I spent some time trying to code up the average true range of the last three days, and then look at the range for the current day.
What I did was use the CurrentDayOHL().High and .Low dataseries and then save the previous values and average them together to get a three day average range.
Then I measured the Opening price of today vs the current price, to see how much range we've moved right "now". I also tried measuring against how much we've moved higher vs. how high we normally move to gauge the "room" left in a move, and how much we've moved lower.
I must say, I failed. The code just wasn't working. I believe it is because the strategy I am using it on is a multi-time frame strategy and also only trades certain hours of the day. Having multi-time frame made the DataSeries variables much more complex, having to rely on CurrentBar and bars.SessionBreak etc. Then having it only trade certain hours of the day further complicated things, because there were gaps in the data from the hours it wasn't trading.
So. I am hoping someone else will step up with their method.
I am using Zen Fire, so for the day range I considered using a 1440 minute bar but later changed it to 60 minute because of problems I was experiencing with CurrentDayOHL().
Maybe someone can come at this a different direction. I would like to employ these types of risk assessments in my rule book.
Want my help or input? 1) Please don't PM me, instead make a post on the forum. 2) In your post, mention me by typing @Big Mike.
If you want to support our community, become an Elite Member.
I owe this thread a spreadsheet which I'll post later today. Been busy learning Ninja Script . Also adding a Kelly formula to the spreadsheet.
FWIW I look at the ATR and put it manually into the spreadsheet every few weeks or whenever I think there has been a important change in volatility, and for the hours I trade (2am to 11:30am EST) there are two distinct ranges... volatility increases significantly at 0930am EST (duh!). I've been using a mean of my entire trading session and get stopped out more than I like during NYSE mornings.
Mike if you are calculating rolling daily ATR and trading cash hours, perhaps you need to only use futures data from cash hours for the ATR calculation? I.E. the gaps are a part of how much more "move" is left in the move. Just a thought as I work on my first coffee of the day...
The following user says Thank You to MXASJ for this post:
Here you go. A JPEG and a Excel spreadsheet. Top part is based on how much you are prepared to risk per trade (2% of equity in this case), what the 14 period ATR is for the timeframe you are trading, and what your stop loss point is as ATR. It looks at margin as well and gives you the lower number of the two (contracts tradeble under stop loss rules vs. margin rules).
I've added a Kelly formula underneath. Please check the math on that first!
Critique it, change it, and post it back if you find it useful.
The following 10 users say Thank You to MXASJ for this post:
Does your account balance change enough intraday to affect the number of contracts you can trade? Ouch!
The one thing I'm looking at is running different strats from 0200-0930 and 0930-1130 as the ATR changes from about 0.9 to about 2.0... so in theory I'm trading smaller size and with wider stops during the NYSE morning.
Otherwise that's a spreadsheet I don't need to look at too often unless there has been a significant change in my account equity or in market volatility.