[原创]函数不能在if then语句中顺利通过,非常重要,急请解决! [金字塔]
- 咨询内容:
函数不能在if then语句中顺利通过,非常重要,急请解决!已经按照论坛的相关帖子 进行了函数替换,但还是不解决问题,求编程指导。之前IF then,也引用到了BARSLAST, ref函数,就能顺利通过,现在在条件内加入突破反手条件,就不能通过了,求解决方法。
BBR0:=BARSLAST(high<下下轨 and LOW<下下轨);downout:=BBR0<2;PXXG:=BARSLAST(C<下下轨 and isdown>3)<4;BBR1:=BARSLAST(CROSS(REF(ZIG(3,5),1),ZIG(3,5)));BBR2:=BARSLAST(CROSS(ZIG(3,5),REF(ZIG(3,5),1)));BBR3:=BARSLAST(CROSS(ZIG(3,5),REF(ZIG(3,5),1)))>1;buycond:=BBR1>BBR2 and CLOSE<=下轨 and BBR3 AND HOLDING=0;
if buycond AND NOT(JXK)thenBEGIN BUY(holding=0,lots,LIMITr,CLOSE); //DRAWTEXT(1,HIGH*1.005,'111') ,COLORGREEN;and close-中轨>0.32*(中轨-下轨)AND NOT(JXK OR downout OR PXXG) if JXK thenBEGINbuyshort(holding>0 and JXK,0);sell(holding=0,lots);END
BCR1:=BARSLAST(CLOSE<=中轨);psellcond:=CLOSE>=下下轨 and BCR1<2 and ENTERBARS>8 and close-中轨>0.32*(中轨-下轨),NOAXIS;if psellcond then BEGIN SELLSHORT(holding<0,0,LIMITr,CLOSE);ENDBCR2:=BARSLAST(CLOSE>=中轨)pbuycond:=CLOSE<=上上轨 and BCR2>3 and ENTERBARS>5 and 中轨-close>0.36*(上轨-中轨) ,NOAXIS;if pbuycond thenBEGIN SELL(holding>0,0,LIMITr,CLOSE);END - 金字塔客服:
downout:=BARSLAST(high<下下轨 and LOW<下下轨)<2;
PXXG:=BARSLAST(C<下下轨 and isdown>3)<4;
buycond:=BARSLAST(CROSS(REF(ZIG(3,5),1),ZIG(3,5)))>BARSLAST(CROSS(ZIG(3,5),REF(ZIG(3,5),1))) and CLOSE<=下轨
and BARSLAST(CROSS(ZIG(3,5),REF(ZIG(3,5),1)))>1 AND HOLDING=0 and not(downout OR PXXG ) ;
if buycond AND NOT(JXK)then
BEGIN
BUY(holding=0,lots,LIMITr,CLOSE);
//DRAWTEXT(1,HIGH*1.005,'111') ,COLORGREEN;and close-中轨>0.32*(中轨-下轨)
END
psellcond:=CLOSE>=下下轨 and BARSLAST(CLOSE<=中轨)<2 and ENTERBARS>8 and close-中轨>0.32*(中轨-下轨),NOAXIS;
if psellcond then
BEGIN
SELLSHORT(holding<0,0,LIMITr,CLOSE);
END
pbuycond:=CLOSE<=上上轨 and BARSLAST(CLOSE>=中轨)>3 and ENTERBARS>5 and 中轨-close>0.36*(上轨-中轨) ,NOAXIS;
if pbuycond then
BEGIN
SELL(holding>0,0,LIMITr,CLOSE);
END
这是之前能够通过的代码
- 用户回复:
BCR2:=BARSLAST(CLOSE>=中轨)
pbuycond:=CLOSE<=上上轨 and BCR2>3 and ENTERBARS>5 and 中轨-close>0.36*(上轨-中轨) ,NOAXIS;
第一句后面少个分号
- 网友回复:
刚才已将分号补上,还是不能通过
- 网友回复:
BBR0:=BARSLAST(high<下下轨 and LOW<下下轨);downout:=BBR0<2;PXXG:=BARSLAST(C<下下轨 and isdown>3)<4;BBR1:=BARSLAST(CROSS(REF(ZIG(3,5),1),ZIG(3,5)));BBR2:=BARSLAST(CROSS(ZIG(3,5),REF(ZIG(3,5),1)));BBR3:=BARSLAST(CROSS(ZIG(3,5),REF(ZIG(3,5),1)))>1;buycond:=BBR1>BBR2 and CLOSE<=下轨 and BBR3 AND HOLDING=0;
if buycond AND NOT(JXK)thenBEGIN BUY(holding=0,lots,LIMITr,CLOSE); //DRAWTEXT(1,HIGH*1.005,'111') ,COLORGREEN;and close-中轨>0.32*(中轨-下轨)AND NOT(JXK OR downout OR PXXG) if JXK thenBEGINbuyshort(holding>0 and JXK,0);sell(holding=0,lots);END
BCR1:=BARSLAST(CLOSE<=中轨);psellcond:=CLOSE>=下下轨 and BCR1<2 and ENTERBARS>8 and close-中轨>0.32*(中轨-下轨),NOAXIS;if psellcond then BEGIN SELLSHORT(holding<0,0,LIMITr,CLOSE);ENDBCR2:=BARSLAST(CLOSE>=中轨);pbuycond:=CLOSE<=上上轨 and BCR2>3 and ENTERBARS>5 and 中轨-close>0.36*(上轨-中轨),NOAXIS;if pbuycond thenBEGIN SELL(holding>0,0,LIMITr,CLOSE);END
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 1145508240 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容