Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Thank you! I have fixed the problem.

      Bye.

      Michel

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by mgco4you, Today, 09:46 PM
      0 responses
      1 view
      0 likes
      Last Post mgco4you  
      Started by Rapine Heihei, Today, 08:19 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 08:25 PM
      0 responses
      6 views
      0 likes
      Last Post Rapine Heihei  
      Started by f.saeidi, Today, 08:01 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 07:51 PM
      0 responses
      8 views
      0 likes
      Last Post Rapine Heihei  
      Working...
      X