Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest data is different from live data

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

    #31
    Jamie,

    Where exactly did you put this statement? If you put it in OnBarUpdate, it will only check once a tick is received.

    You may want to consider working in OnPositionUpdate(), OnOrderUpdate(), OnExecution(), etc depending on what you are trying to accomplish:





    I do not have any suggestions for you other than what is on our Performance Tips:

    MatthewNinjaTrader Product Management

    Comment


      #32
      overfills

      I am still getting the messages ( today it was the very first trade of the day). I am trading two accounts with two separate (brand new) computers. The first account on the first computer does not have these problems at all. The second account gets these overfill messages frequently. I have the same scripts running on both ( I actually copied them from my main computer and transferred them over.
      Basically,
      if (Position,MarketPosition == MarketPosition.flat && Close [0] > Close [1] && ToTime (Time blahblahblah > 63000 BlahBlah < 131000)
      {
      EnterLOng();
      }

      Worked on my old computer, works on computer 1 but does not work on computer 2.
      I am deleting all scripts on computer 2 now and I will transfer from computer 1 again.... any suggestions?

      Jamie Hendrix

      Comment


        #33
        These errors are conditional - if you did not have these on one PC with the same script, it just may not have attempted to fill two or more orders at the same time.

        Are you able to reproduce this error message with using Market Replay? If so, I would suggest running the script on Replay on both PC's to see if the errors are duplicated to further isolate.
        MatthewNinjaTrader Product Management

        Comment


          #34
          overfills

          As a matter of fact, I have run them both on replay and the errors never occur.... only in real time. I can not see any reason why?

          Comment


            #35
            If you're unable to isolate this, please enable the TraceOrders property in your strategy. The next time you receive this error, please provide me with the text outputted around the time the error was received.

            More information on enabling and using TraceOrders can be found below:

            MatthewNinjaTrader Product Management

            Comment


              #36
              overfills

              Matthew, I deleted the old script and loaded it from computer 1 ( the one that works), enabled trace orders and ran it.... same thing happened. I have copied the log to a flash drive.... how do I send you the log so you can view it?

              Jamie Hendrix

              Comment


                #37
                Hello,

                You can just copy and paste the information that was outputted. I do not necessarily need the entire log, just what occurred a few minutes before and after the error was received.
                MatthewNinjaTrader Product Management

                Comment


                  #38
                  overfills

                  Matthew, I deleted the old script and loaded it from computer 1 ( the one that works), enabled trace orders and ran it.... same thing happened. I have attached the log file.

                  Jamie Hendrix

                  Comment


                    #39
                    Hello,

                    I'm sorry, I do not see the log file attached. Can you please try again?
                    MatthewNinjaTrader Product Management

                    Comment


                      #40
                      Date Category Message
                      ######## Strategy Disabling NinjaScript strategy 'Ofc818vv8/677328eac365493b9c0f9bea5a9e3793' ######## Order Order='1666009858/82789!AMP!ac82789' Name='Stop loss' New state=Cancelled Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=1286.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009859/82789!AMP!ac82789' Name='Profit target' New state=Cancelled Instrument='ES 03-12' Action=BuyToCover Limit price=1283.75 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009858/82789!AMP!ac82789' Name='Stop loss' New state=PendingCancel Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=1286.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009859/82789!AMP!ac82789' Name='Profit target' New state=PendingCancel Instrument='ES 03-12' Action=BuyToCover Limit price=1283.75 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Position Instrument='ES 03-12' Account='82789!AMP!ac82789' Avg price=-7.92281625142643E+28 Quantity=0 Market position=Long Operation=Remove Currency=UsDollar ######## Execution Execution='15338920232' Instrument='ES 03-12' Account='82789!AMP!ac82789' Exchange=Globex Price=1284.25 Quantity=1 Market position=Long Operation=Insert Order='1666030056' Time='1/12/2012 9:22:26 AM' ######## Order Order='1666030056/82789!AMP!ac82789' Name='Close' New state=Filled Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=1 Fill price=1284.25 Error=NoError Native error='' ######## Order Order='1666030056/82789!AMP!ac82789' Name='Close' New state=Working Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666030056/82789!AMP!ac82789' Name='Close' New state=Accepted Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='530bfe1a40fb40ef905f2e2ad254d359/82789!AMP!ac82789' Name='Close' New state=PendingSubmit Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009859/82789!AMP!ac82789' Name='Profit target' New state=Working Instrument='ES 03-12' Action=BuyToCover Limit price=1283.75 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009859/82789!AMP!ac82789' Name='Profit target' New state=Accepted Instrument='ES 03-12' Action=BuyToCover Limit price=1283.75 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009858/82789!AMP!ac82789' Name='Stop loss' New state=Working Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=1286.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666009858/82789!AMP!ac82789' Name='Stop loss' New state=Accepted Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=1286.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='4ef537b0afa14db18eb4a36aa7aad8fb/82789!AMP!ac82789' Name='Profit target' New state=PendingSubmit Instrument='ES 03-12' Action=BuyToCover Limit price=1283.75 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='d27a32ea4b8d4cd0ae88a235d497bb19/82789!AMP!ac82789' Name='Stop loss' New state=PendingSubmit Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=1286.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' ######## Strategy An over fill was detected on order 'Order='1666042682/82789!AMP!ac82789' Name='Sell short' State=Filled Instrument='ES 03-12' Action=SellShort Limit price=1284 Stop price=0 Quantity=1 Strategy='Ofc818vv8' Type=Limit Tif=Gtc Oco='' Filled=1 Fill price=1284 Token='42408f3f2e2a466391ccdce773da5a62' Gtd='12/1/2099 12:00:00 AM'' generated by strategy 'Ofc818vv8/677328eac365493b9c0f9bea5a9e3793' : This strategy will be disabled and NinjaTrader will attempt to cancel/close any strategy generated orders and positions. Please check your account orders and positions and take any appropriate action. ######## Position Instrument='ES 03-12' Account='82789!AMP!ac82789' Avg price=1284 Quantity=1 Market position=Short Operation=Insert Currency=UsDollar ######## Execution Execution='15338920000' Instrument='ES 03-12' Account='82789!AMP!ac82789' Exchange=Globex Price=1284 Quantity=1 Market position=Short Operation=Insert Order='1666042682' Time='1/12/2012 9:22:18 AM' ######## Order Order='1666042682/82789!AMP!ac82789' Name='Sell short' New state=Filled Instrument='ES 03-12' Action=SellShort Limit price=1284 Stop price=0 Quantity=1 Type=Limit Filled=1 Fill price=1284 Error=NoError Native error='' ######## Order Order='1666042682/82789!AMP!ac82789' Name='Sell short' New state=PendingCancel Instrument='ES 03-12' Action=SellShort Limit price=1284 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Strategy An Enter() method to submit an entry order at '1/12/2012 9:22:22 AM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation. ######## Order Order='1666042682/82789!AMP!ac82789' Name='Sell short' New state=Working Instrument='ES 03-12' Action=SellShort Limit price=1284 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666042682/82789!AMP!ac82789' Name='Sell short' New state=Accepted Instrument='ES 03-12' Action=SellShort Limit price=1284 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='fe51c7f8217c429da712cd9b4ea75818/82789!AMP!ac82789' Name='Sell short' New state=PendingSubmit Instrument='ES 03-12' Action=SellShort Limit price=1284 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=Cancelled Instrument='ES 03-12' Action=SellShort Limit price=1284.25 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=PendingCancel Instrument='ES 03-12' Action=SellShort Limit price=1284.25 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=Working Instrument='ES 03-12' Action=SellShort Limit price=1284.25 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=Accepted Instrument='ES 03-12' Action=SellShort Limit price=1284.25 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=PendingChange Instrument='ES 03-12' Action=SellShort Limit price=1284.25 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=Working Instrument='ES 03-12' Action=SellShort Limit price=1284.5 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1665985739/82789!AMP!ac82789' Name='Sell short' New state=Accepted Instrument='ES 03-12' Action=SellShort Limit price=1284.5 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='efdc0e0901164bbd8360f2d435cd35e6/82789!AMP!ac82789' Name='Sell short' New state=PendingSubmit Instrument='ES 03-12' Action=SellShort Limit price=1284.5 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' ######## Order Order='1666004853/82789!AMP!ac82789' Name='Stop loss' New state=Cancelled Instrument='ES 03-12' Action=BuyToCover Limit price=0 Stop price=1287 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' ######## Position Instrument='ES 03-12' Account='82789!AMP!ac82789' Avg price=-7.92281625142643E+28 Quantity=0 Market position=Long Operation=Remove Currency=UsDollar ######## Execution Execution='15338918848' Instrument='ES 03-12' Account='82789!AMP!ac82789' Exchange=Globex Price=1284.25 Quantity=1 Market position=Long Operation=Insert Order='1666004854' Time='1/12/2012 9:21:42 AM'

                      Comment


                        #41
                        You have an order to named 'Close' and an order to 'Sell Short' that are attempting to fill around the same time.

                        Can you please clarify what you are attempting to accomplish at this time? Are you attempting to reverse your position?
                        MatthewNinjaTrader Product Management

                        Comment


                          #42
                          No. The strategy never just reverses positions. There are initiated orders with corresponding Profit target and stop loss orders placed. Orders are not initiated unless a position is closed out by either hitting the profit target or by hitting the stop loss. It should ignore all signals unless the position is "flat".

                          Comment


                            #43
                            Hello,

                            Your position will not be long or short until after the order has filled. Your strategy is producing multiple signals which is trying to place two trades at once. You can try to override this by using a flag in OnOrderUpdate(), and OnExecution() which will give you a more accurate reflection of the events occurring in your strategy regarding the position and order state.

                            OnExecution() : http://www.ninjatrader.com/support/h...nexecution.htm

                            OnOrderUpdate() : http://www.ninjatrader.com/support/h...rderupdate.htm
                            MatthewNinjaTrader Product Management

                            Comment


                              #44
                              I am using managed orders (EnterLong, EnterShort, etc.). Do I have to switch to unmanaged orders?

                              Comment


                                #45
                                No, you can work within the managed approach.

                                If you switched the unmanaged approach, you would no longer receive these errors, however you can still find yourself in a situation where you have two orders which are attempting to fill at the same time. You would need to program your own order handling rules to prevent these situations from occurring with the unmanaged reproach and this is reserved for advanced programmers only.
                                MatthewNinjaTrader Product Management

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                72 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                43 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                25 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                28 views
                                0 likes
                                Last Post TheRealMorford  
                                Started by Mindset, 02-28-2026, 06:16 AM
                                0 responses
                                58 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Working...
                                X