if time>=145500 and time<15000 then begin
sell(1,0,market);
sellshort(1,0,market);
end
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<4 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
这个策略我想把每次的开仓1手变为开总资金的25%,然后收盘前5分钟自动平仓
帮忙修改下吧
把posnum改成25%
收盘前分钟平仓参见上面
能说具体点吗?
buy( _DEBUG,PosNum=25%,limitr,myEntryPrice);
这样?
原来资金:=100;
下单手数:= 100*20% *保证金比率/multiper