Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]如何编写以下语句

1楼
zhuangjyuan 发表于:2015/7/14 10:31:51
模型大概如下,
收盘价跌破MA60,则按收盘价开空
如果价格收回MA60,则按收盘价止损平空;
做多则相反;
如果被止损,则从被止损K线算起,20个周期不再开仓,等20个周期后在按开仓条件判断开仓
请问这个该如何编写,谢谢!!
2楼
jinzhe 发表于:2015/7/14 10:36:13

variable:n=0;

ma60:ma(c,60);

if holding=0 and cross(ma60,c) and n=0 then begin

     buyshort(1,1,limitr,close);

     n:=1;

end

 

if holding=0 and cross(c,ma60) and n=0 then begin

     buy(1,1,limitr,close);

     n:=1;

end

 

if cross(c,ma60) then sellshort(1,0,limitr,close);

 

if cross(ma60,c) then sell(1,0,limitr,lcose);

 

if holding=0 and cross(c,ma60) and n=1 and exitbars>20 then buy(1,1,limitr,close);

 

if holding=0 and cross(ma60,c) and n=1 and exitbars>20 then buyshort(1,1,limitr,close);

共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03125 s, 3 queries.