开多:buy(CROSS(H1,H2)&&COUNT(ENTERBARS=1,N)<25&&TIME>=0920&&TIME<1440 and holding=0 ,1,thisclose);
开空:buyshort(CROSS(H1,H2)&&COUNT(enterbars=1,N)<25&&TIME>=0920&&TIME<1440 and holding=0 ,1,thisclose);
平空:sellshort(CROSS(H1,H2)&&COUNT(enterbars=1,N)<25 and holding>0 ,1,thisclose);
平多:sell(CROSS(H2,H1)&&COUNT(enterbars=1,N)<25 and holding<0,1,thisclose);
sell(C<ENTERPRICE-12*MINDIFF,holding,marketr);
sellshort(C>ENTERPRICE+12*MINDIFF,holding,marketr);
盘整函数怎样才能发挥作用,又不影响抓住行情?请帮助分析下面语句:
CROSS(H1,H2)&&COUNT(BARSBK=1||BARSSK=1,N)<30&&TIME>=0920&&TIME<1450&&PANZHENG=0,BPK;
CROSS(H2,H1)&&COUNT(BARSBK=1||BARSSK=1,N)<30&&TIME>=0920&&TIME<1450&&PANZHENG=0,SPK;
老师你好,谢谢帮助修改。
问题:
此主题相关图片如下:qq图片20160128162758.png

1、设置采用的是走完一根K线开仓,平仓采用 marketr和limitr价格形式,而程序是在走完一根K线开仓的,平仓信号却在走完一根K线前发出了,所以这种情况下,造成该笔开仓不能被平仓,或一直持有,或与下次同方向平仓信号时才能平仓。
例如:今天13::15信号显示开多并多止盈,其实是该根K线结束后以1924点开了多单,并没有多止盈,这个多单一直持有。在13:20以1920.8点只是空开,不再平多单,并且这个空单下笔也不平仓。如此,这样有一笔多单一直持有至收盘,亏损巨大。
2、多止损25个点不起作用。
有关程序如下:
平空:sellshort(BB10>1 AND AA10>REF(AA10,1) ,0, marketr);
if BB10>1 AND AA10>REF(AA10,1) and holding=0 and bjd=0 then begin
buy(1,1, marketr);
bjd:=1;
bjk:=0;
end
平多:sell(BB10<1 AND AA10<REF(AA10,1) ,0,marketr);
if BB10<1 AND AA10<REF(AA10,1) and holding=0 and bjk=0 then begin
buyshort(1,1,marketr);
bjk:=1;
bjd:=0;
end
多止损:sell(C<ENTERPRICE-25*MINDIFF,holding,marketr);
空止损:sellshort(C>ENTERPRICE+25*MINDIFF,holding,marketr);
if hhv(h,enterbars+1)>=enterprice+10*mindiff and hhv(h,enterbars+1)<=enterprice+15*mindiff and (h>=enterprice+5*mindiff) and (l<=enterprice+5*mindiff) then 多止盈1:sell(1,0, limitr,enterprice+5*mindiff);
if hhv(h,enterbars+1)>=enterprice+16*mindiff and hhv(h,enterbars+1)<=enterprice+20*mindiff and (h>=enterprice+10*mindiff) and (l<=enterprice+10*mindiff) then 多止盈2:sell(1,0, limitr,enterprice+10*mindiff);
if llv(l,enterbars+1)<=enterprice-10*mindiff and llv(l,enterbars+1)>=enterprice-15*mindiff and (h>=enterprice-5*mindiff) and (l<=enterprice-5*mindiff) then 空止盈1:sellshort(1,0, limitr,enterprice-5*mindiff);
if llv(l,enterbars+1)<=enterprice-16*mindiff and llv(l,enterbars+1)>=enterprice-20*mindiff and (h>=enterprice-10*mindiff) and (l<=enterprice-10*mindiff) then 空止盈2:sellshort(1,0, limitr,enterprice-10*mindiff);
if hhv(h,enterbars+1)>=enterprice+21*mindiff and close<=hhv(h,enterbars+1)-3*mindiff then 移动平多:sell(1,0,market);
if llv(l,enterbars+1)<=enterprice-21*mindiff and c>=llv(l,enterbars+1)+3*mindiff then 移动平空:sellshort(1,0,market);
1.看下单日志
2.CROSS(H1,H2)&&COUNT(BARSBK=1||BARSSK=1,N)<30&&TIME>=0920&&TIME<1450&&PANZHENG=0,BPK;
h1上穿h2 同时 BARSBK=1或者BARSSK=1在n周期内小于30次 同时时间在09:20到14:50之间,同时panzheng=0,然后买平后反手开
panzheng是什么干什么用的,你要去问元作者
CROSS(H2,H1)&&COUNT(BARSBK=1||BARSSK=1,N)<30&&TIME>=0920&&TIME<1450&&PANZHENG=0,SPK
这个和上面差不多
1.这个是图表交易看信号的,如果不希望同根k线平仓,则在平仓条件里面加入:enterbars>0
2.你举个不起作用的例子
3楼是一个单独的问题,与1楼、2楼无关。
例如:3楼的图片中(在图片中间位置)的第一个买入(红箭头)今天IH50股指上证501602在13::15信号显示开多并多止盈,其实是该根K线结束后以1924点开了多单,并没有多止盈,这个多单一直持有。其后在13:20以1920.8点只是空开,不再平多单,并且这个空单下笔也不平仓。如此,这样有一笔多单一直持有至收盘,亏损巨大。
这些是已经结合日志才看到的结果。
图表信号和实际账户持仓没有关系,前面同根k线出开多平多信号以及走完k线下单导致的开多后来不及平仓,所以给了一个解决办法是在平仓条件里面加上enterbars>0
或者直接使用持仓同步功能
并不能
同步持仓是让图表上的持仓和实际账户的持仓一致,并不是什么让“同根k线开多平多”