Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Replay and IOrders

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

    Market Replay and IOrders

    Using beta 6.

    I amended the SampleOnOrderUpdate to remove the tokens comparisons and compare orders directly (attached).
    Strategy seems to work fine when using historical data (from market replay). When I start (play) the market replay it goes weird.
    1. chart on the top shows original chart with the strategy. I highlighted place from where market replay was started.
    2. chart in the middle is a chart with no strategy applied but on which somehow entry and stop places from original chart (1) are displayed.
    3. chart 3 is what the original chart (1) looks like after reloading NinjaScripts on the chart.

    I also noticed that after removing the strategy from chart 1 it looks exactly like chart 2.

    Displaying entries on chart number 2 seems like a bug.
    As for strategy itself - is there anything else (apart from removing Token values) I need to change for real-time (market replay) orders to make IOrders work correctly under NT7 ?
    Attached Files
    Last edited by gregid; 12-28-2009, 11:52 AM.

    #2
    Thanks, I will have someone follow up and look into this.
    RayNinjaTrader Customer Service

    Comment


      #3
      It seems like the comparison:
      entryOrder == execution.Order
      (line 93)

      is never successfull while runninng the strategy in realtime.

      Comment


        #4
        gregid, I was unable to reproduce the issue you've posted here. Could you please post the exact steps (eg. 1) start NT 2) connect Market Reply 3)create new chart 4) apply strat 5) hit play 6) etc) necessary to create the unexpected behavior?

        In addition, it is recommended to be as explicit as possible when doing comparisons. In your strategy, is it necessary to not use token checks? Tokens are the basic comparison tool in NinjaTrader.
        AustinNinjaTrader Customer Service

        Comment


          #5
          I used the recommendation you had in Code Breaking changes pdf:

          NinjaScript Strategies
          IExecution.IOrder property will now reflect the order state at the time of OnExecution() meaning it could return values ahead of the currently being processed IExecution.

          o Ex: There can be discrepancies between IExecution.Order.Filled and IOrder.Filled as accessed during order placement
          IOrder objects are now unique throughout the lifetime of a strategy

          o Do NOT hold onto .Token values since they will change as the strategy goes from historical to live

          o To check for equality you can directly compare IOrders. Example:
          if (entryOrder == order)

          o IOrder.Action has been renamed to IOrder.OrderAction
          To clarify - I am more concerned about real-time execution than orders being displayed on 2 charts.

          The steps I used:
          1. Open NT
          2. File > New Chart > Range 4
          3. File > New Chart > Range 4
          4. Connect to Market Replay
          5. Add strategy (SampleOnOrderUpdate_NoToken) to the first chart, Enable
          6. Play Market Replay

          After first entry order is placed no other orders follow and neither stop loss or profit target order is ever placed.
          Entry Order is also displayed on the second chart.

          I have exactly the same problem with original reference SampleOnOrderUpdate using token values to compare.

          Output window (with TraceOrders = true):
          02/11/2009 14:32:42 Entered internal PlaceOrder() method at 02/11/2009 14:32:42: Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='MyEntry' FromEntrySignal=''


          Log and trace file: attached
          Attached Files

          Comment


            #6
            My apologies, I forgot about those changes. We'll look further into this and get back to you.

            EDIT: I did notice that no other orders were placed so I can confirm that much.

            EDIT once more: Does this only happen when using Market Replay?
            AustinNinjaTrader Customer Service

            Comment


              #7
              Thanks Austin

              Unfortunately I can't check with other connection as Market Replay is at the moment the only "real-time" connection I have but I suppose it could be the same with other connections.

              Comment


                #8
                gregid, I modified your script a bit and it appears it works correctly. I recommend running it on the simulated data feed with the trend turned up as high as it goes. It places orders over and over again like it should.
                Attached Files
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Problem still persists with replay101 account

                  Thanks Austin,

                  Yes I confirm the strategy works with simulation data feed (sim account) but so does the original strategy I attached in the first post. I'm sorry I didn't check it before (I forgot about simulation).
                  Anyway the problem still persists with the market replay data feed (replay account). What I found out is this:

                  When account is replay101 and you start Market Replay so as the data comes in real-time here is what happens:
                  When OnExecution method is called after executing entryOrder the same entryOrder == null (!!!) in OnExecution. But if you check for the value of entryOrder in OnBarUpdate entryOrder !=null (which is correct). I updated the sample strategy with some additional Print statements to present the problem.

                  At this point I believe it is a bug related to Replay101 account processing IOrders in real-time and not a problem with my strategy (which works fine with Sim101 account). Do you confirm my understanding of the issue
                  Attached Files

                  Comment


                    #10
                    Austin is out right now and will pick this up later this week.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Just an update, we will not be able to look into this until next Tuesday. Thanks for your patience.
                      RayNinjaTrader Customer Service

                      Comment


                        #12
                        Just a reminder, thanks

                        Comment


                          #13
                          gregid, it does appear as if the Replay101 connection does not correctly compare IOrders like any other account does. I will forward this information on.
                          AustinNinjaTrader Customer Service

                          Comment


                            #14
                            gregid,

                            This was a bug and should be fixed in the next version. Please try again then. Thank you for reporting.
                            Josh P.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            602 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            347 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            103 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            560 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            559 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X