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

Re: Function Help



PureBytes Links

Trading Reference Links


VBatla@xxxxxxx wrote:

>
>I'm looking to put this into EL and could use a little help.  
>
>Then add the O - L values together over the last 4 days and divide that 
>number by 4.
>
>That number = Hgsval
>
>This is a little complicated for me but I have compiled this and it 
>verifies 
>OK but I don't think it's working quite right.
>
>Vars:  Hgsval(0);
>
>If C > O then begin
>
>Hgsval = (O[4] - L[4]) + (O[3] - L[3]) + (O[2] - L[2]) + (O[1] - L[1]) 
/ 4;
>
>end;
>
>


You need one more set of parentheses....  Try this:

Hgsval = ((O[4] - L[4]) + (O[3] - L[3]) + (O[2] - L[2]) + (O[1] - L[1])) 
/ 4;

To simplify, you could use:

Hgsval = Average(O-L, 4)[1];


You might even want to make the "4" an input value:

Input:  HgsLen(4);

Hgsval = Average(O-L, HgsLen)[1];




OM