runmode:0;
lots:=1;
shortma:ma(close,5);
longma:ma(close,20);
entrylongcond:=close<shortma and close>longma;
exitlongcond:=close<longma;
entryshortcond:=close>shortma and close<longma;
exitshortcond:=close>longma;
offset:=mindiff;
if holding>=0 then begin
if entrylongcond then
buy(1,lots,limitr,close+offset);
end
if holding<=0 then begin
if entryshortcond then
buyshort(1,lots,limitr,close-offset);
end
if holding>0 then begin
if exitlongcond then begin
sell(1,holding,limitr,close-offset);
end
end
if holding<0 then begin
if exitshortcond then begin
sellshort(1,holding,limitr,close+offset);
end
end
盈亏:asset-500000,noaxis,linethick2;
次数:totaltrade,linethick0;
胜率:percentwin*100,linethick0;
持仓:state,linethick0;
价位:enterprice,linethick0;