
runmode:0;
input:p(120);
input:n(120);
input:s(2);
input:m(20);
myma:=ma(open,p);
mysar:=sar(n,s,m);
entrylongcond:=open>myma and high>=mysar;
exitlongcond:=low<=mysar;
entryshortcond:=openexitshortcond:=high>=mysar;
if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,max(open,mysar));
if entryshortcond then
buyshort(1,1,limitr,min(open,mysar));
end
if holding>0 then begin
if exitlongcond then
sell(1,holding,limitr,min(open,mysar));
end
if holding<0 then begin
if exitshortcond then
sellshort(1,holding,limitr,max(open,mysar));
end
盈亏:asset-500000,noaxis,coloryellow,linethick2;