Input:Len1(5),Len2(10),Len3(15),Len4(30);
Vars:Avg1(0),Avg2(0),Avg3(0),Avg4(0);
Vars:Avg1a(0),Avg2a(0),Avg3a(0),Avg4a(0);
Vars:GoLong(0);
Avg1=Average(Close of data2,Len1);
Avg2=Average(Close of data2,Len2);
Avg3=Average(Close of data2,Len3);
Avg4=Average(Close of data2,Len4);
Avg1a=Average(Close ,Len1);
Avg2a=Average(Close ,Len2);
Avg3a=Average(Close ,Len3);
Avg4a=Average(Close ,Len4);
if Avg1>Avg2 and Avg2>Avg3 and Avg3>Avg4 and Low of data2<=Avg4 then GoLong=1;
if GoLong=1 then begin
if Avg1a>Avg2a and Avg2a>Avg3a and Avg3a>Avg4a and Close> Avg4 then Buy this bar at close;
end;
if marketposition=1 then begin
if Avg1a<Avg2a and Avg2a<Avg3a and Avg3a<Avg4a then Sell next bar at market;
end;
|