Intraday true range on a Daily chart
Author: trader rog
Creation Date: 5/3/2011 8:01 PM
profile picture

trader rog

#1
Hi Everyone,
I am trying to compute true range using intraday data (5 minute bars) for use in this entry constraint: today's true range is greater than 80% of the last 20 days average true range. I know to synchronize the average true range, however, coding today's true range is giving me trouble. Entries are intraday so computing true range with end of day data would not suffice. Thank you to anyone that can help out.
profile picture

Eugene

#2
(Before coding) let's agree on definitions first, what is "today's true range"? In your case, is it the distance between today's intraday High and Low, or it also includes a gap between today's High/Low and yesterday's Close as well?
profile picture

trader rog

#3
It includes gaps, so it is the greatest of: 1)today's high and low, 2) today's high and previous close, or 3) today's low and previous close.
profile picture

Eugene

#4
How about this simple solution?

Intraday / Multi-Time Frame | Accessing Intraday data from Daily
profile picture

Cone

#5
That solution is to access intraday data in a daily chart, not required here.

trader_roq is trading intraday and wants to access Daily indicators, so you just need to use the SetScaleDaily() method, create the ATR indicator, RestoreScale(), Synchronize(). Voila.

The only thing left is to calculate today's true range on the fly using the intraday data:

CODE:
Please log in to see this code.
profile picture

Eugene

#6
Oops, you're right. I was about to code a pseudo-daily ATR when something went through my mind and see, a momentary lapse of reason.
profile picture

Cone

#7
I see where the confusion is - it's the title that indicates something different than what was requested. So we're both right!
profile picture

trader rog

#8
Thanks very much Eugene and Cone. That was a great help!
profile picture

therooster

#9
Hey guys

Still learning but I think this has answered a question I also had.

If I want to take intraday entries on a 1hr chart but only in the direction of an SMA cross on the daily would I be correct in thinking I can use 'SetScaleDaily' to obtain the direction then reset scale to hourly to strat scanning for trades?

Thanks for the help.

Regards






Roy
profile picture

Eugene

#10
Hi Roy,

Yes, your understanding is correct. Check out SetScaleDaily in the QuickRef for a code example illustrating a SMA crossover on Daily data.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).