如何实现在不同K线实现加仓 [金字塔]
- 咨询内容:
//如果当前是没有持仓的状态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
//不要跳转,让程序检查同一根K线是否可以加仓 //GOTO CONTINUELINE ; END //IF
//如果当前持有多头仓位的状态
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
END //IF
您好,TURTLEUNITS控制着在同根K加仓,而如果以上述策略公式为例,我想实现不同根K满足条件加仓该怎么办?非常感谢。 - 金字塔客服:
下单语句增加条件 enterbars>1比如
buy(_debug and enterbars>1,.......);
- 用户回复:
您好,能写的具体写嘛,比如下面的怎么修改成满足条件不同根K线开一次仓,直至平仓离场。//如果当前是没有持仓的状态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
END //IF
//如果当前持有多头仓位的状态
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 //建立多头离场条件 LONGX1 := (LOW < T10LO) ; IF LONGX1 AND BUYORDERTHISBAR=0 THEN BEGIN MYEXITPRICE := IF(OPEN<T10LO-MINDIFF ,OPEN ,T10LO-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 - 网友回复:
这个比较复杂,技术咨询中
- 网友回复: 嗯,希望能尽快解决,我想不同根K滚动开仓,是很多塔友想实现的。
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 1145508240 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容