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

Re: Arrays



PureBytes Links

Trading Reference Links

You have to shift the values manually.

Var: Sum;
Array: Diff[3](0);

If Close > Close[1] then begin
  Diff[3] = Diff[2];
  Diff[2] = Diff[1];
  Diff[1] = Close - Close[1];
  Sum = Diff[1] + Diff[2] + Diff[3];
End;

If the array is large, you can use a loop to shift them one at a time
rather than typing all the shifts.

-- 
  Dennis


Chris Evans wrote:
> 
> OK so I want to add up the last 3 up close
> Differences using an array:
> 
> Array:Diff[3],(0);
> 
> If close>close[1] then
> Diff[1]=close-close[1];
> 
> Sum=Diff[1]+Diff[2]+Diff[3];
> 
> But I don't think this works.. I thought that
> an array value would slide over each time a new
> value was put in the first array location ..-
> obviously not
> 
> Help(?)...
> 
> 
> 
>


  • References: