Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Transition from Historical to Realtime error

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

    Transition from Historical to Realtime error

    I am getting the error:

    "Strategy 'XXX' has been disabled because it attempted to modify a historical order that has transitioned to a live order. Please see the help guide for more information on transitioning order references from historical to live."

    This error is happening when running in the Strategy Analyzer. There is no realtime data -- it is Saturday and the last bar on the chart is Friday's closing bar.

    I have code that transitions the orders in OnStateChange() when state changes to Realtime. The problem is that I get this error but the state never changed to Realtime.

    It also says in the doc on "Advanced Order Handling": "Tip: When the real-time order is submitted, there is a generic Order object passed into the OnOrderUpdate() method containing the live order details which can be used for debugging. It is recommended you use the helper GetRealtimeOrder() when your strategy transitions to real-time to update your order references"

    I've output to the Output window every call to OnOrderUpdate and see no live orders all order ID's are of the format NT-NNNNN-NNN.

    On a chart with the same setup it shows an active entry order. (strategy uses Unmanaged orders) and the state transition to Realtime is happening and no error is generated. OnOrderUpdate shows the live order.

    So there seems to be some issue with the Strategy Analyzer. It shouldn't be generating this error.

    #2
    Hello EquityBoost2,

    Please (copy and then) reduce the script to the minimum code necessary to reproduce the error, then please attached this reduced version as an attachment with your next post so that I may test this behavior on my end.

    To export a NinjaTrader 8 NinjaScript do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message

    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>


    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,
      I've encountered the same problem in the same conditions (unmanaged strategy, no transition to realtime in Strategy Analyzer, problem only appears in Strategy Analyzer). Did you manage to resolve the issue?

      Comment


        #4
        Hello InteRadek,

        Are you using the latest version of NinjaTrader 8 (8.0.9.0)?

        Have you created a simplified export for me to test that includes no code that is not absolutely necessary to reproduce the behavior?

        If so, please include this with your next post.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you for your interest. Yes, I'm using the latest version. In section State.Terminated I have a function, that is looking for open orders and sets Order variables to null, when orders are cancelled. When "Exit on session close" occured and it was a last available historical session, it triggered the error when it tried to null the profitOrder or stoplossOrder from State.Terminated. So I added a simple IF statement to not triger the function, when it is running in a Strategy Analyzer and the problem is resolved.
          Code:
          if (this.Id != -1)
            function();

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Rubens_2020, Today, 01:48 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by kempotrader, Today, 01:34 PM
          1 response
          23 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by bc24fl, Today, 01:50 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by vantojo, Today, 01:39 PM
          0 responses
          14 views
          0 likes
          Last Post vantojo
          by vantojo
           
          Started by bosajin, 01-21-2021, 09:15 AM
          7 responses
          58 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Working...
          X