价在60日均价线之上平空开多,价在60日均价线之下平多开空,亏损20%强行平仓,自己不懂,特向高手求助编写模型程序。谢谢! |
ma60:=ma(c,60);
if c>ma60 then begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
end
if c<ma60 then begin
sell(holding>0,0,market);
buyshort(holding=0,1,market);
end
if (c-enterprice)/enterprice>=20% and holding<0 then sellshort(holding<0,0,market);
if (enterprice-c)/c>=20% and holding>0 then sell(holding>0,0,market);
仅供参考,不负责盈亏
请您根据自己交易经验,进行修改后再实际应用
不知是何原因?以下公式测试通不过,文字提示为: 无法识别的算术表达方式。请帮我检测一下。
另请老师帮我把60均线设置成参数。
谢谢!
附公式如下:
ma60:=ma(c,60);
if c>ma60 then begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
end
if c<ma60 then begin
sell(holding>0,0,market);
buyshort(holding=0,1,market);
end
if (c-enterprice)/enterprice>=20% and holding<0 then sellshort(holding<0,0,market);
if (enterprice-c)/c>=20% and holding>0 then sell(holding>0,0,market);
input:n(60,1,300,10);
ma60:=ma(c,N);
if c>ma60 then begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
end
if c<ma60 then begin
sell(holding>0,0,market);
buyshort(holding=0,1,market);
end
if (c-enterprice)/enterprice>=0.2 and holding<0 then sellshort(holding<0,0,market);
if (enterprice-c)/c>=0.2 and holding>0 then sell(holding>0,0,market);