Page 1 of 2

Need help in new daily indicator

Posted: Sat Dec 15, 2007 9:47 am
by metotron
Hi all!!!
I need smal help. I want to make indicator that will calculate Average Daily Range on 15min or 1h time frames.
For that i need High and low from previously days.
Example: if i want to make Average D. Range from 20 days i must take high and low from each of this days. Its easy if i use Daily chart. But i want to use 15 min or 1h.
Ferst way is taken DATA2 But it's not very comfortable.
Next way....i don't know :-(
Help please!
Thanks!

Posted: Sun Dec 16, 2007 2:23 am
by gmoney
Do a search for this in the TradeStation forums and I'm sure you will find a solution.

The first thing that came to mind is something like this (don't know if correct, just first thought):

var: n(0), avgdailyrange(0);

for n = 1 to 20
begin
avgdailyrange = average(highd(n) - lowd(n),20);
end;

Posted: Sun Dec 16, 2007 4:02 am
by TheRumpledOne
Use my TRO_24HOURS indicator.

You want to know the range for each hour right?

Posted: Sun Dec 16, 2007 10:13 am
by metotron
"You want to know the range for each hour right?"

i think not...
I want to get Average Daily Range (for 20 days) on 15 or 1h harts.
Example:
R1-yesterday range was 120pips
R2 - 2days ago - 100 pips
R3 - 3days ago - 97
-----------
R20 - 20days ago -180 pips
Average Daily Range = (R1+R2+R3+..+R20)/20
I can do it very easy for daily charts But i need it for calculating on 15 min charts.
Example: i Make enter long if 5SMA crosses 12SMA and (Today High- Today Low) < Average Daily Range

Posted: Sun Dec 16, 2007 10:30 am
by metotron
gmoney wrote:Do a search for this in the TradeStation forums and I'm sure you will find a solution.

The first thing that came to mind is something like this (don't know if correct, just first thought):

var: n(0), avgdailyrange(0);

for n = 1 to 20
begin
avgdailyrange = average(highd(n) - lowd(n),20);
end;


It does't work - it recalculate Range on each 1h bar. But it's wrong. Each day has only 1 Range - for all day. This Range changed only on 00:00

Posted: Sun Dec 16, 2007 4:25 pm
by TheRumpledOne
Ok, now I understand what you want.

Use TRO PLOT.

Set the input to averagefc( (HighD(0) - LowD(0) ) , 20 )

You'll also need to format the indicator scaling.. set it to subplot 2 or higher.

You may want it to display as a histogram, so format the style.

Posted: Mon Dec 17, 2007 5:17 pm
by metotron
Oh!!! Great Thanks!
I works!!!
But it's not my final question! Next will be after 2 days. I will try to build Cluster Indicators for FOREX :-)

Posted: Mon Dec 17, 2007 6:10 pm
by metotron
Hm...TRO PLOT works good. But... its calculate its value on each bars inside day. Avery day has only one Daily Range.
Look at pic - i try to show what i need

Posted: Tue Dec 18, 2007 12:04 am
by TheRumpledOne
Well that depends...... for today, the range changes everytime there is a new daily high or daily low.

If you count today, then the value is going to change.

averagefc( (HighD(1) - LowD(1) ) , 20 )

Using yesterday's data should take care of it.

Posted: Tue Dec 18, 2007 5:59 pm
by metotron
TheRumpledOne wrote:Well that depends...... for today, the range changes everytime there is a new daily high or daily low.

If you count today, then the value is going to change.

averagefc( (HighD(1) - LowD(1) ) , 20 )

Using yesterday's data should take care of it.


no...it doesn't work....look at the pic. it changes its value every bar inside day :-(