Quote:
|
Originally Posted by Pepinillo
Hello everyone,
Im trying to code my first MT4 indicator. It's a simple indicator to show on the upper left corner of the chart the average daily range (high - low, in pips) for a currency during the last 100 periods. But no matter how hard I try, it just doesnt do anything at all and I cannot spot out where the problem is.
Can anyone please have a quick look and tell me where the bug is? I attach the indicator down below.
By the way, is there any chance I could also set another parameter to analyze the average range during the last 100 days but only from 7 AM to noon? that's the time frame I usually trade so that piece of info would be useful for me too.
Thank you very much in advance 
|
You´re not correctly calling the double n?
PHP Code:
double av=0;
int i=0;
for(i=1;i<=100;i++)
av = av + (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/Point;
double n=av/PeriodsBack;
Comment("Average Daily Range is ",n);
Comment line should be like this?
PHP Code:
Comment("Average Daily Range is ",+ n)
Take a search for Ogeima´s daily range calculator.