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 mjairg, 07-20-2023, 11:57 PM
      3 responses
      213 views
      1 like
      Last Post PaulMohn  
      Started by TheWhiteDragon, 01-21-2019, 12:44 PM
      4 responses
      544 views
      0 likes
      Last Post PaulMohn  
      Started by GLFX005, Today, 03:23 AM
      0 responses
      3 views
      0 likes
      Last Post GLFX005
      by GLFX005
       
      Started by XXtrader, Yesterday, 11:30 PM
      2 responses
      12 views
      0 likes
      Last Post XXtrader  
      Started by Waxavi, Today, 02:10 AM
      0 responses
      7 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Working...
      X