[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CODE QUESTION



PureBytes Links

Trading Reference Links

You are missing a parenthesis. When you write:

Plot1 ((H[0] - L[0]) + (H[1] - L[1]) + (H[2] - L[2]) /
 3,"3 DAY RANGE");

Division is always done first, so it calculates
  (H[2] - L[2]) /  3
And then it adds it to the previous two ranges. You
would need to write:
Plot1 (((H[0] - L[0]) + (H[1] - L[1]) + (H[2] - L[2]))
/  3,"3 DAY RANGE");

Or you can save time and effort and write:
Plot1( Average(Range, 3), "3DayRange");
Plot2( Average(Range, 5), "5DayRange");

H



--- Husky <husky@xxxxxxxxxxxxxxxx> wrote:
> Good Day,
> 
>    I am trying to create a indicator to tell me the
> average of the intra-day
> range for the last 3 days and the last 5 days. The
> indicator is not
> displaying values correctly when i check against the
> numbers manually..
> could someone point out to me what i have done
> incorrectly please?
> 
> 
> 
> Plot1 ((H[0] - L[0]) + (H[1] - L[1]) + (H[2] - L[2])
>  /  3,"3 DAY RANGE");
> 
> Plot2 ((H[0] - L[0]) + (H[1] - L[1]) + (H[2] - L[2])
> +(H[3] - L[3]) +
> (H[4] - L[4]) + (H[5] - L[5]) / 5,"5 DAY RANGE");
> 
> 
> 
>                                                     
>           Thankyou,
> William
> 
>