Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order canceled on close the bar on lower timeframe

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Order canceled on close the bar on lower timeframe

    Hi,
    I’m programming a multi timeframe (MTF) strategy.
    When the strategy open an order and bar on the lower time frame closed the order is cancelled:
    • 01.10.2014 07:58:09 Order='0d8a26dcec25434d9e648883d25657ee/Replay101' Name='Buy' State=PendingSubmit Instrument='ES ##-##' Action=Buy Limit price=1962.25 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='0d8a26dcec25434d9e648883d25657ee' Gtd='01.01.0001 00:00:00'
    • 01.10.2014 07:58:09 Order='0d8a26dcec25434d9e648883d25657ee/Replay101' Name='Buy' State=Accepted Instrument='ES ##-##' Action=Buy Limit price=1962.25 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='0d8a26dcec25434d9e648883d25657ee' Gtd='01.01.0001 00:00:00'
    • 01.10.2014 07:58:09 Order='0d8a26dcec25434d9e648883d25657ee/Replay101' Name='Buy' State=Working Instrument='ES ##-##' Action=Buy Limit price=1962.25 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='0d8a26dcec25434d9e648883d25657ee' Gtd='01.01.0001 00:00:00'
    • 01.10.2014 07:58:09 Open: 1963 Close: 1962.5 <- Bar close on lower timeframe
    • 01.10.2014 07:58:09 Order='0d8a26dcec25434d9e648883d25657ee/Replay101' Name='Buy' State=PendingCancel Instrument='ES ##-##' Action=Buy Limit price=1962.25 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='0d8a26dcec25434d9e648883d25657ee' Gtd='01.01.0001 00:00:00'
    • 01.10.2014 07:58:09 Order='0d8a26dcec25434d9e648883d25657ee/Replay101' Name='Buy' State=Cancelled Instrument='ES ##-##' Action=Buy Limit price=1962.25 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='0d8a26dcec25434d9e648883d25657ee' Gtd='01.01.0001 00:00:00'
    • 01.10.2014 08:00:13 Open: 1962.25 Close: 1962.5 <- Bar close on lower timeframe


    What can I do to fix this problem?

    Bye,

    Michel

    #2
    Hello,

    Thank you for the question.

    It is likely that it is being canceled if the condition to submit the order is no longer true and the order is not marked as LiveUntilCanceled = true.

    An order is canceled if you Submit an order and then another call to OnBarUpdate occurs in which the order is not re submitted, in this case you submit on your primary and then have OnBarUpdate called again for the secondary which canceled the order.

    To resolve this, you could either use LiveUntilCanceled or logic, http://ninjatrader.com/support/helpG...EnterLongLimit

    To use LiveUntilCancelled you would do this in the overloads when submitting the order. So as an example, instead of:

    Code:
    EnterLongLimit(int quantity, double limitPrice, string signalName)
    you would use

    Code:
    EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)
    If you instead wanted to correct this with logic, the condition that became true to submit the order would need to also remain true during the OnBarUpdate calls for the secondary series, whatever logic is required to make that change would be required to correct this logically.

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse,

      Thank you! I have fixed the problem.

      Bye.

      Michel

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      264 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      168 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      171 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      257 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      209 views
      0 likes
      Last Post CarlTrading  
      Working...
      X