Problem: Sum all of the values of the median Price,
over the past "X" periods, where "X" may be variable
(i.e., change from Bar-to-Bar).
In Tradestation or a similar language, you may have done this:
Inputs: Price((H+L)/2);
Vars: summ(0)
For count = 0 to IntPortion (X + 0.5) - 1 begin
summ = summ + Price[count];
End;
Here is how you accomplish this loop in Metastock with ASI:
summ := ExtFml( "ASI.Sum", MP(), X);
|