
runmode:0;
input:entrystop(0.5);
input:exitstop(0.5);
input:malength(120);
myma:=ma(open,malength);
entrylongcond:=open>myma and high>=open*(1+entrystop/100);
exitlongcond:=low<=open*(1-exitstop/100);
entryshortcond:=openexitshortcond:=high>=open*(1+exitstop/100);
if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,open*(1+entrystop/100));
if entryshortcond then
buyshort(1,1,limitr,open*(1-entrystop/100));
end
if holding>0 then begin
if exitlongcond then
sell(1,holding,limitr,open*(1-exitstop/100));
end
if holding<0 then begin
if exitshortcond then
sellshort(1,holding,limitr,open*(1+exitstop/100));
end
盈亏:asset-500000,noaxis,coloryellow,linethick2;