PureBytes Links
Trading Reference Links
|
At 6:46 PM -0400 6/24/99, Alain Lefebvre wrote:
>If I want to see the average price of September, or any other months, of
>the last ten years, is there a way to do it in Trade Station?
>Thank you, Al
That depends upon what you mean for "average".
When applied to a Monthly chart, the following code will calculate the
average price for September (defined as the average of the price at the end
of August and the end of September). Then it will calculate the average of
all of those values and print the result. It also plots the average of
September on the September bar.
Bob Fulks
Input: TestMo(9);
Vars: Mo(0), Yr(0), Ave(0), Count(0), Sum(0), MoAve(0);
Mo = Month(Date);
Yr = Year(Date);
if Mo = TestMo then begin
Count = Count + 1;
MoAve = (Close + Close[1]) / 2;
Sum = Sum + MoAve;
Plot1(MoAve, "1");
end;
if LastBarOnChart then begin
if Count <> 0 then Ave = Sum / Count;
Print(Date:6:0, Ave:5:2);
end;
|