图表交易,标准版即可,代码如下:
ma20:=ma(c,20);
if c>ma20 and holding=0 then buy(1,20%,market),pertrader;
if (c-enterprice)/enterprice>=0.05 then sell(1,0,market);
if (enterprice-c)/enterprice>=0.02 then sell(1,0,market);
if c<ma20 and holding=0 then buyshort(1,20%,market),pertrader;
if (enterprice-c)/enterprice>=0.05 then sellshort(1,0,market);
if (c-enterprice)/enterprice>=0.02 then sellshort(1,0,market);