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

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

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        30 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        943 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        9 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by rocketman7, Today, 01:00 AM
        0 responses
        4 views
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        28 views
        0 likes
        Last Post wzgy0920  
        Working...
        X