Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems in Real time Strategy with Evaluation account (Rithmic)

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

    Problems in Real time Strategy with Evaluation account (Rithmic)

    I have a problem running my strategy, I have been able to do a backtest in playback Connection, with market replay in for 3 years that I have the data and everything works correctly, but when I activate the strategy in Real time with Evaluation Account using Ritmic connection in many Opportunities present me with failures, for example today I did not place Stop Loss orders.

    Downloading today's data and running the strategy works perfectly.

    Do you know something about this topic, some other client had the same situation.​

    #2
    Hello HGTrader,

    It's necessary to debugging output to understand what is happening.
    We need to see that the order was submitted, ignored, or rejected, and if the order was working when the price was touched.

    If this is only occurring after running for a long time in real-time, it may be necessary to write to file.
    Below is a link to an example of writing to file.
    Citizens of the NinjaTrader Community, A common question we hear from clients is 'why are results from backtest different from real-time or from market replay?'. Live orders are filled on an exchange with a trading partner on an agreed upon price based on market dynamics. Backtest orders are not using these market dynamics.


    Enable TraceOrders and override the OnOrderTrace method to write to file as well.



    Print the order object in OnOrderUpdate() (so we can see each order change states).

    Print the Time, Open, High, Low, and Close in OnBarUpdate() (so we can see when the price is touched).

    Provide the output text file with your next post and I will be happy to assist with analyzing the output.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks, I will do it, a question: I am using unmanaged orders in the strategy, and when I exit a position manually it does not eliminate the OCO order, is this correct?

      Comment


        #4
        Hello HGTrader,

        If you have an order attached to another order with OCO that fills, that would cancel the opposing order.

        But if you are placing a manual order that is not attached to other orders with OCO, that would not cancel any other opposing orders.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Chelsea

          Even without being able to solve the problem, as I explained, when you run the strategy in Playback everything works perfectly, but when I activate it in the Real market, errors appear randomly that I cannot identify why they occur, I attach the lines of the code, with their respective Print I am working with 3 types of orders with different names, so I basically copy the method and just change the name of each entry.

          Today, for example, I executed an additional Stop Loss order for the amount of 1


          I would like to send you the Log and Trace files because if you want to see them, where can I send them to you?


          thanks


          Attached Files

          Comment


            #6
            Thats your problem look here https://ninjatrader.com/support/help...rderupdate.htm
            Click image for larger version

Name:	Screenshot_20231227-211823_Brave.jpg
Views:	377
Size:	847.5 KB
ID:	1283910
            If you use the unmanaged approach and rithmic, you should only do everything via OnOrderUpdate without OnExecutionUpdate, otherwise there will be problems because the API does not always run synchronously. I don't know who is responsible for this, but both NT and Rithmic seem to be able to finally fix the problem. It's easier to write a note in the description than to solve the problem.
            sidlercom80
            NinjaTrader Ecosystem Vendor - Sidi Trading

            Comment


              #7
              Rithmic and Interactive Brokers Users: Due to provider API design these adapters do not guarantee the sequence of events of OnOrderUpdate, OnExecution, and OnPositionUpdate. Therefore when working on a strategy that will run on these connections it is best practice to only work with passed by value data.


              but I don't understand what best practice means to only work with passed by value data from that callback to eliminate the dependency on the sequence of events.

              Can you help me with some example?​

              Thanks

              Comment


                #8
                Hello HGTrader,

                If you want assistance with an error message, provide the full error message (Ctrl + c to copy Ctrl + v to paste, or provide a screenshot).

                With the Rithmic / IB updates with OnExecutionUpdate() and OnOrderUpdate() these can occur in different sequence. The help guide message is stating not to rely on the sequence these update and not to use an order object in OnExecutionUpdate() and not to use an execution object in OnOrderUpdate().

                Below is a link to an example.
                Hello, I see in the documentation you have fixed: 15048 Added Adapter, Rithmic Updated Rithmic API to version 11.3.0.0 Can you elaborate on that please? Will OnOrderUpdate() OnExecutionUpdate() and OnPositionUpdate() be called in the expected order?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9


                  Thank you Chelsee

                  I already made all the changes, and when the program tried to enter executive, the computer froze, I had to enter through the platform that they use Ritmic pro to be able to close the operation.

                  I have no errors in Log



                  Comment


                    #10
                    @sidlercom80

                    If we manage all orders by Order Update, does it solve the whole problem with Ritmic?
                    And thanks for the reply and the help.​

                    Comment


                      #11
                      Hello HGTrader,

                      That would depend on why the strategy is not submitting orders as the expected time and the code in the script. Only debugging by adding prints and enabling TraceOrders and analyzing the output would provide an answer for that. (note, the information needed to see why the strategy is behaving as it is, will not be in the log and trace)

                      That said, when using Rithmic or Interactive Brokers, it is important not to mix logic between OnExecutionUpdate() and OnOrderUpdate() and not to use Order objects in OnExecutionUpdate() or use Execution objects in OnOrderUpdate(). Further, it's important to design the logic not to rely on these events to happen in any specific sequence.

                      This is why we advise to put all logic in OnExecutionUpdate() or put all of the logic in OnOrderUpdate(). If you script is triggering an action after an execution (when an order fills) and does not use any order objects, all code can go in OnExecutionUpdate(). If the script is using the state or other properties of an order, then all logic should go in OnOrderUpdate().
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      54 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      130 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      72 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      44 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      49 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X