Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Crashing

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

    Strategy Crashing

    Hi,

    I have a strategy that displayed no issues during back testing or real time testing using Sim101, however when I switched it live, it would occasionally crash with the following message:

    Strategy 'RenkoReversal/136759459' submitted an order that generated the following error 'Unable to change order'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
    Disabling NinjaScript strategy 'RenkoReversal/136759459'

    I presume that my trail stop logic is the issue but I honestly haven't been able to debug it well.

    Do you recognize this message? Are there any likely culprits you could point me to?


    Probably related question:
    I have been using ChangeOrder() to modify orders created by ExitShortStopMarket()... is that not proper?

    #2
    Hello NickyD,

    Thanks for your post.

    This could have been an occurrence of an in flight execution where the order was filled after the ChangeOrder was submitted and before NinjaTrader saw the fill of the order. The ChangeOrder would result in an error then because the exchange no longer has this active order. To be sure, we would have to check the log and trace files.

    These errors can be handled in a NinjaScript strategy by setting the RealtimeErrorHandling property to IgnoreAllErrors and to trap the events in OnOrderUpdate(). This is considered an advanced technique and it should be noted that you will have to handle all possible scenarios your strategy may encounter since the strategy will no longer panic and abort.

    I'll include openly available documentation below. Please also send us your log and trace files so we can more accurately tell you what had occurred. You may send these files to platformsupport [at] ninjatrader [dot] com with the text "Attn Jim" and I'll be able to take the ticket and have a closer look.

    RealtimeErrorHandling - https://ninjatrader.com/support/help...orhandling.htm

    OnOrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm

    You may follow the instructions below to send us your log and trace files.
    • Open your NinjaTrader folder under My Documents.
    • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
    • Send the 2 compressed folders as attachments to platformsupport [at] ninjatrader [dot] com with the text "Attn Jim"
    • Once complete, you can delete these compressed folders.


    I'm happy to be of any further assistance.

    Comment


      #3
      I hope that doesn't turn out to be the case, as what's happened in this scenario is that I had a stop order in at 7443 and a profit target order in at 7483, but when the strategy crashed I was closed out at 7467.75 with the stop and target orders showing as cancelled on my order screen. I sent those logs via email.

      Thanks,
      Nick

      Comment


        #4
        Hello NickyD,

        I have just sent a reply via email.

        The error was actually a native error from the exchange stating that the order was already at the requested price when the ChangeOrder reached the exchange.

        Looking at the code you provided, there looks like there was a logical issue where the ChangeOrder could be submitted with the same price level because the controlling condition used logical "&" operators instead of conditional "&&" operators.

        I have included some tips to modify the code and add prints so you can observe the current price level of the order and the price level you want to modify the order to.

        If there is anything else we can do to help, please let us know.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X