全部 智大领峰 TBQuant功能 TBL语言 TB开户 问答专区 高手圈 其他
已解决
为何频繁开仓
loafertb 分享到
2024-08-08 16:28

Params

   Numeric notbef(930);       //Time

   Numeric notaft(1456);       //Time

   Numeric notbef1(2130);       //Time

   Numeric notaft1(2256);       //Time


Vars


Numeric TurtleUnits(1); // 交易手数

Bool SendOrderThisBar(False); // 当前Bar有过交易

Events

OnBar(ArrayRef<Integer> indexs)

{




// 长周期突破开仓 Failsafe Breakout point

If(MarketPosition ==0 && (Time>notbef/10000 and Time<notaft/10000) || (Time>notbef1/10000 and Time<notaft1/10000))

{

If( close >High[1])

{

Buy(TurtleUnits,Close);

SendOrderThisBar = True;

}

If( close<Low[1])

{

//SellShort(TurtleUnits,Close);

SendOrderThisBar = True;

}

}





 

  if(marketposition!=0 and Time>=0.1456 && Time<=0.15)

    {


     

               BuyToCover(0,Close);  

       

               Sell(0,Close);

    }



   if(marketposition!=0 and Time>=0.2256 && Time<=0.23)

    {


     

               BuyToCover(0,Close);  

       

               Sell(0,Close);

    }

   

}

日内交易,无仓位开仓一手,为何频繁开仓,怎么修改

kyover

data-href=

逻辑判断问题

你的本意是三个表达式 a b c

a 必须满足 b和c任一满足即可

那就必须写成a and (b or c)

但是你写成了a and b or c

你的写法意思是,要么ab同时满足,要么c满足

2024-08-09 14:50
您未登录,请先 登录注册 后发表评论
顶部