以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  如果平仓后,在多少根K线内不在开仓,应该如何编写  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=83969)

--  作者:冷锋566
--  发布时间:2015/8/15 12:58:21
--  如果平仓后,在多少根K线内不在开仓,应该如何编写
如果平仓后,在几根K线内不在开仓,应该如何编写?比如在5根、或10根K线内不在开仓,谢谢!
--  作者:jinzhe
--  发布时间:2015/8/17 9:01:39
--  
exitbars>5    exitbars>10
--  作者:冷锋566
--  发布时间:2015/8/17 12:03:35
--  比如下面这样写对吗?
比如下面这样写对吗?但是都没信号了
ma3:ma(c,13);
ma5:ma(c,21);
pkkd:cross(ma3,ma5);
pdkk:cross(ma5,ma3);
sellshort(pkkd and holding<0,0,limitr,close);
buy(pkkd and exitbars>5 and holding=0,1,limitr,close);
sell(pdkk and holding>0,0,limitr,close);
buyshort(pdkk and exitbars>5 and holding=0,1,limitr,close);

--  作者:jinzhe
--  发布时间:2015/8/17 13:16:53
--  
variable:bj=0;
ma3:ma(c,13);
ma5:ma(c,21);
pkkd:cross(ma3,ma5);
pdkk:cross(ma5,ma3);
if pkkd and holding=0 and bj=0 then begin
buy(pkkd and  holding=0,1,limitr,close);
bj:=1;
end
if pdkk and holding=0 and bj=0 then begin
buyshort(pdkk and holding=0,1,limitr,close);
bj:=1;
end
 
if pkkd and holding=0 and bj=1 and exitbars>10 then buy(1,1,market);
if pdkk and holding=0 and bj=1 and exitbars>10 then buyshort(1,1,market);
sell(pdkk and holding>0,0,limitr,close);
sellshort(pkkd and holding<0,0,limitr,close);

--  作者:冷锋566
--  发布时间:2015/8/17 14:31:28
--  variable:bj=0;这是什么意思
variable:bj=0;这是什么意思?
--  作者:jinzhe
--  发布时间:2015/8/17 14:32:44
--  
全局变量的标记,用来记录是否开过首仓,开过后标记改变,后续的开仓就能加exitbars>10的条件了