I have IOGMode(IOGMode.Enabled) in my script.
During realtime trading with autotrade, I noticed that when I have enter an order with limit order, my exit order will trigger at the next bar (ie 60 minutes later).
However when I use the same script on backtest, with backtest precision on (set at 1 min bar). I can get exit order execute much faster.
Below is a snippet of my strategy:
Code: Select all
protected override void CalcBar()
{
if (StrategyInfo.MarketPosition == 0 && EntryCondition == true
{
//Place entry Enter Limit order
}
if (StrategyInfo.MarketPosition != 0)
{
//place exit limit order
}
if (Bars.Status == EBarState.Close)
{
//strategy logic to determine EntryCondition
}
}
Thanks in advance