您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

提示begin语句后缺少end [金字塔]

  • 咨询内容: H0 := HHV(H,ENTERBARS);
    IF POSITION=1 AND BARPOS>T20 AND H>L THEN BEGIN //多头加仓条件 WHILE (HIGH>MYENTRYPRICE+0.5*N) AND TURTLEUNITS<1 DO BEGIN MYENTRYPRICE := IF(OPEN>MYENTRYPRICE+0.5*N ,OPEN ,MYENTRYPRICE+0.5*N ) ; MYENTRYPRICE := CEILING(MYENTRYPRICE/MINDIFF)*MINDIFF ; BUY( _DEBUG, POSNUM, LIMITR, MYENTRYPRICE); TURTLEUNITS := TURTLEUNITS+1 ; BUYORDERTHISBAR := 1;
    END //WHILE //建立多头离场条件1.1 H1 := H0-AVGENTERPRICE;//H1表示多头最大浮动盈利 H2 := H0;//H2表示多头最高价 LONGX1.1 := (H1 <3*R  AND H1 >=2*R);             //------------------------此句提示begin语句后缺少end IF LONGX1.1 AND BUYORDERTHISBAR=0 THEN BEGIN MYEXITPRICE := IF(OPEN<(H2-0.3*H1)-MINDIFF ,OPEN ,(H2-0.3*H1)-MINDIFF ) ; MYEXITPRICE := CEILING(MYEXITPRICE/MINDIFF)*MINDIFF ; SELL( _DEBUG ,0,LIMITR,MYEXITPRICE); POSITION := 0 ; TURTLEUNITS := 0 ; END    
           //建立多头止损条件 LONGX2 := (LOW<MYENTRYPRICE-2*N)  ;
    IF LONGX2 AND POSITION=1 AND BUYORDERTHISBAR=0 THEN BEGIN MYEXITPRICE := IF(OPEN<MYENTRYPRICE-2*N ,OPEN ,MYENTRYPRICE-2*N ) ; MYEXITPRICE := FLOOR(MYEXITPRICE/MINDIFF)*MINDIFF ; SELL( _DEBUG ,0,LIMITR,MYEXITPRICE); POSITION := 0 ; TURTLEUNITS := 0 ; END
             在编辑测试时,总是提示begin语句后缺少end,不知问题出在哪里,请金字塔老师解答,谢谢。

     

  • 金字塔客服:

    在这段代码最后加end

     

     

  • 用户回复: //开始执行时 初始化数据IF BARPOS=1 THEN BEGIN //POSITION := 0 ;
    END //IF
    //如果当前是没有持仓的状态IF POSITION=0 AND BARPOS>T20 AND H>L THEN BEGIN
    //建立多头进场条件 LONG := H > T20HI ; //多头进场 IF LONG THEN BEGIN MYENTRYPRICE := IF(OPEN>T20HI+MINDIFF ,OPEN ,T20HI+MINDIFF ) ; BUY( _DEBUG,POSNUM,LIMITR,MYENTRYPRICE); POSITION := 1 ; TURTLEUNITS := 1 ; N := AVGTR ;  //*********** BUYORDERTHISBAR := 1;
    END //IF

    //建立空头进场条件 SHORT := L < T20LO ; //空头进场 IF SHORT AND POSITION=0 THEN BEGIN MYENTRYPRICE := IF(OPEN<T20LO-MINDIFF ,OPEN ,T20LO-MINDIFF ) ; BUYSHORT( _DEBUG,POSNUM,LIMITR,MYENTRYPRICE); POSITION := -1 ; TURTLEUNITS := 1 ; N := AVGTR ; BUYORDERTHISBAR := 1;
    END //不要跳转,让程序检查同一根K线是否可以加仓 //GOTO CONTINUELINE ; END  //IF

    //如果当前持有多头仓位的状态
    H0 := HHV(H,ENTERBARS);
    IF POSITION=1 AND BARPOS>T20 AND H>L THEN BEGIN //多头加仓条件 WHILE (HIGH>MYENTRYPRICE+0.5*N) AND TURTLEUNITS<1 DO BEGIN MYENTRYPRICE := IF(OPEN>MYENTRYPRICE+0.5*N ,OPEN ,MYENTRYPRICE+0.5*N ) ; MYENTRYPRICE := CEILING(MYENTRYPRICE/MINDIFF)*MINDIFF ; BUY( _DEBUG, POSNUM, LIMITR, MYENTRYPRICE); TURTLEUNITS := TURTLEUNITS+1 ; BUYORDERTHISBAR := 1; 
    END //WHILE //建立多头离场条件1.1*********** H1 := H0-AVGENTERPRICE;//H1表示多头最大浮动盈利 H2 := H0;//H2表示多头最高价 LONGX1.1 := (H1 <3*R  AND H1 >=2*R); IF LONGX1.1 AND BUYORDERTHISBAR=0 THEN BEGIN MYEXITPRICE := IF(OPEN<(H2-0.3*H1)-MINDIFF ,OPEN ,(H2-0.3*H1)-MINDIFF ) ; MYEXITPRICE := CEILING(MYEXITPRICE/MINDIFF)*MINDIFF ; SELL( _DEBUG ,0,LIMITR,MYEXITPRICE); POSITION := 0 ; TURTLEUNITS := 0 ; END     //建立多头离场条件1.2***********    LONGX1.2 := (H1 <4*R  AND H1>=3*R)  ; IF LONGX1.2 AND BUYORDERTHISBAR=0 THEN BEGIN    MYEXITPRICE := IF(OPEN<(H2-0.2*H1)-MINDIFF ,OPEN ,(H2-0.2*H1)-MINDIFF ) ; MYEXITPRICE := CEILING(MYEXITPRICE/MINDIFF)*MINDIFF ; SELL( _DEBUG ,0,LIMITR,MYEXITPRICE); POSITION := 0 ; TURTLEUNITS := 0 ; END //建立多头离场条件1.3***********  LONGX1.3 := (H1>=4*R)  ; IF LONGX1.3 AND BUYORDERTHISBAR=0 THEN BEGIN    MYEXITPRICE := IF(OPEN<(H2-0.1*H1)-MINDIFF ,OPEN ,(H2-0.1*H1)-MINDIFF ) ; MYEXITPRICE := CEILING(MYEXITPRICE/MINDIFF)*MINDIFF ; SELL( _DEBUG ,0,LIMITR,MYEXITPRICE); POSITION := 0 ; TURTLEUNITS := 0 ; END //建立多头止损条件 LONGX2 := (LOW<MYENTRYPRICE-2*N)  ;
    IF LONGX2 AND POSITION=1 AND BUYORDERTHISBAR=0 THEN BEGIN MYEXITPRICE := IF(OPEN<MYENTRYPRICE-2*N ,OPEN ,MYENTRYPRICE-2*N ) ; MYEXITPRICE := FLOOR(MYEXITPRICE/MINDIFF)*MINDIFF ; SELL( _DEBUG ,0,LIMITR,MYEXITPRICE); POSITION := 0 ; TURTLEUNITS := 0 ; END
    GOTO CONTINUELINE ;

    END//IF

    这是整段代码,仍然提示begin语句后缺少end,您看怎么解决,谢谢。

     

  • 网友回复:

    这段代码还会有这个提示?

     

  • 网友回复: 是的,不知问题出在哪里?

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容