indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Amibroker

Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 18-10-2011, 08:57 PM
rvlv rvlv is offline
Join Date: Apr 2009
Posts: 88
Thanks: 70
Thanked 139 Times in 51 Posts
rvlv will become famous soon enoughrvlv will become famous soon enoughrvlv will become famous soon enough
Default Dynamic ADR AFL-required code

Hi experts

We use average daily range(daily high and daily low for tracking trading opportunities.

Obviously you cant use a oneday average range.
here is the concept.
can somebody give it a afl form,please


the concept is

It computes yesterday's range (range= high - low),then
the previous 5day, 10day and 20 days ranges.

And it calculates the "Average Day Range" of these four ranges = (yesterday's+ Prev 5 Day Range + Prev 10 Day Range + Prev 20 Day Range)/4.
So, if yesterday's Day Range was 80, the Previous 5 Day Range was 110, the Previous 10 Day Range was 90 and the Previous 20 Day Range was 120, then the Average Day Range would be 100.
ADR is similar to weighted Day Range.

the trading method is just wait for price to breakout above weadrhi or weadrlow on a price chart and go with tight stoploss.
weadrhi=weighted adr hi
some hints
double AvgDayRange(int nth_day)
double R1,R5,R10,R20;
int i;

R1 = (iHigh(NULL,PERIOD_D1,nth_day)-iLow(NULL,PERIOD_D1,nth_day));
for(i=0;i<5;i++) R5 = R5 + (iHigh(NULL,PERIOD_D1,nth_day+i)-iLow(NULL,PERIOD_D1,nth_day+i));
for(i=0;i<10;i++) R10 = R10 + (iHigh(NULL,PERIOD_D1,nth_day+i)-iLow(NULL,PERIOD_D1,nth_day+i));
for(i=0;i<20;i++) R20 = R20 + (iHigh(NULL,PERIOD_D1,nth_day+i)-iLow(NULL,PERIOD_D1,nth_day+i));

R5 = R5/5;
R10 = R10/10;
R20 = R20/20;


plot price
plot weighted adr hi and lo lines on same chart

one question
if we take an average of past 36days hi and lo,range avrage,we must get adr as given above-i feel this it correct?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to rvlv For This Useful Post:

indiTraders - Forum for the Active Indian Trader > Tools > Software > Amibroker

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


All times are GMT +5.5. The time now is 12:38 PM.

vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2