ma1:=ma(c,5);
ma2:=ma(c,10);
ma3:=ma(c,20);
h3:=max(ma1,max(ma2,ma3));
l3:=min(ma1,min(ma2,ma3));
if close<h3 then begin
sellshort(1,0,thisclose);
buy(holding=0,1,thisclose);
end
if close>h3 then begin
sell(1,0,thisclose);
buyshort(holding=0,1,thisclose);
end
if (c-ref(c,1))/ref(c,1)<=-0.02 then sell(1,0,thisclose);
if (c-ref(c,1))/ref(c,1)>=0.02 then sellshort(1,0,thisclose);