Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Phantom trade

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

    #16
    Inconsistant results

    I have been running the 32 bit icon instead of the 64bit. I remember I got a popup saying something wouldn't work in 64 bit once so I have always used the 32bit version.

    I am not only getting different results than Valentin, I am getting different results each time I run a test on the same data.

    I went ahead and tried a test on the 64bit version and got different results once again.

    Regards
    Brian

    Comment


      #17
      Originally posted by sledge View Post
      Are you using ADD( )? I've seen issues where the first day doesn't start until 10-10:30am on the ADDed item.

      And are you using OnMarketData ?
      The strategy is with one instrument. I only ADD() an indicator to plot on the chart.

      I don't use OnMarketData(), only OnExecution(). But it seems that there is a problem with OnBarUpdate(), where some boolean variables are evaluated.

      Comment


        #18
        Tests on Brian's laptop

        I tested the strategy on Brian's laptop.

        First I deleted all historical data with DX.

        Then I connected to Market Replay. There was some data for 6/5/2015. But when I checked available data, it was since 6/7/2015.

        When I started the strategy, there were some trades with data on 6/5/2015.

        The first exit is on 6/7/2015 21:45. This exit is part of the strategy, just Session Loss Limit is reached after 5 losing trades. So the strategy is OK.

        The strategy resumes trading on the next session and first order is with some strange price.

        I checked data files in Documents\NinjaTrader7\db\data folder. The first available data was for 6/7/2015. I deleted market replay data for 6/7/2015 - 6/9/2015 and downloaded it again. There was still phantom data for 6/5/2015 and the first trade on the new session was still with a strange price.

        It seems that NinjaTrader saves somewhere 'phantom' market replay data and there is some problem with prices.

        What could be the reason?
        Attached Files

        Comment


          #19
          Hello Valyo,

          Thank you for your response.

          Market Replay will pull from the historical data in your database to back fill the charts for the time before the replay starts.

          Please try deleting the folders Data, Day, Minute, Tick and Cache under (My) Documents\NinjaTrader 7\db and then restarting NinjaTrader. Then download the replay data again and test once again.

          Comment


            #20
            Originally posted by NinjaTrader_PatrickH View Post
            Hello Valyo,

            Thank you for your response.

            Market Replay will pull from the historical data in your database to back fill the charts for the time before the replay starts.

            Please try deleting the folders Data, Day, Minute, Tick and Cache under (My) Documents\NinjaTrader 7\db and then restarting NinjaTrader. Then download the replay data again and test once again.
            Hello Patrick,

            I deleted historical data with Historical Data Manager and didn't restart NinjaTrader.

            Isn't deleting with Historical Data Manager enough? If it is not enough, I will delete the folders manually.

            Let me know what to delete - the files in these folders or the folders?

            Thanks,

            Valentin
            Last edited by Valyo; 06-26-2015, 07:38 AM.

            Comment


              #21
              Hello Valyo,

              I recommend deleting the folders after shutting down NinjaTrader for this test. The cache folder could contain corrupted data, but so could the historical data folders. In following these instructions it will create a clean slate to start from for the data.

              Comment


                #22
                Patrick,

                I have tried testing the strategy on 5 different instruments. Every time there is data from before the dates I downloaded from NB.

                I follow the instructions from the Youtube video's.

                I download the dates from the contract month I want but when I connect to Market replay there is always dates from before there. If I try to back the date up on market replay to match the date on the chart everything backs up 2 days, I can do that as many times as I want on any instrument. If I download the 7th-12th the chart will have stuff from the 5th, If I change the date on Market replay to the 5th the chart will then have stuff from the 3rd.

                Regards
                Brian

                Comment


                  #23
                  Hello Brian,

                  Thank you for your response.

                  With a Live License Key it would download the historical data form the NinjaTrader servers.

                  Are you both using a Live License Key or Free Edition License Key?

                  Comment


                    #24
                    Thank you, Patrick.

                    Deleting folders with corrupted data solved both problems - with missing trades and with strange prices.

                    I saw that Brian's NinjaTrader loaded historical data when I opened a new chart with Days to load greater than 0. I had to open the chart with Days to load = 0, so that I could test the strategy with downloaded market replay data only.

                    My NinjaTrader never loads historical data on a market replay chart. As I understand this difference is caused by different licenses - Brian has Live License Key and I have Free Edition License Key.

                    Valentin
                    Attached Files

                    Comment


                      #25
                      Patrick,

                      I am using a purchased license and the problem with the phantom trade is still there.

                      Regards
                      Brian
                      Attached Files
                      Last edited by Briansstocks; 06-28-2015, 04:23 PM. Reason: Didn't attach image.

                      Comment


                        #26
                        So is this a historical trade that isn't really executed in market replay?

                        Comment


                          #27
                          Test 2015-06-29

                          Hello Patrick,

                          I replicated Brian's test without changing anything and got the same phantom order. Then I deleted all data and downloaded market replay data again. I got the the same phantom order again.

                          Here are details:

                          The last orders on the chart are at 6/23/2015 - 15:46, 15:59 and 19:00. The order at 15:59 is not on Orders tab, although it is an EnterLong() order. The executions at 15:59 are on Executions tab.

                          After the test I checked historical data. There was data with DX 09-15 on 6/24, 6/25 and 6/26 only.

                          Then I deleted all data, downloaded market replay data and tested the strategy again - with the same result.

                          What could be the reason for this?
                          Attached Files

                          Comment


                            #28
                            Originally posted by NinjaTrader_Jesse View Post
                            Hello,

                            Thank you for the reply.

                            This is a case where the script would need to be debugged by the developer, possibly on your machine remotely.

                            There are many ways to debug a script but all require access to the code so the developer would likely be the best resource on this item.
                            Valyo, am I correct in assuming that you are the developer of this script? If so, just so that we have a complete picture of the variables involved, were you able to dig up any clues by debugging the code to check the boolean and other variable states, as well as prices at which orders are being placed, and states of any other relevant price-points around the time that the phantom orders show up? Did you spot any red flags in the data that the strategy is working with behind the scenes?
                            Dave I.NinjaTrader Product Management

                            Comment


                              #29
                              Originally posted by NinjaTrader_Dave View Post
                              Valyo, am I correct in assuming that you are the developer of this script? If so, just so that we have a complete picture of the variables involved, were you able to dig up any clues by debugging the code to check the boolean and other variable states, as well as prices at which orders are being placed, and states of any other relevant price-points around the time that the phantom orders show up? Did you spot any red flags in the data that the strategy is working with behind the scenes?
                              Hello Dave,

                              Yes, I am the developer of this script.

                              I debugged the code on my machine and I had no such problems with orders and prices. I did two tests on Brian's machine.

                              The first time when I tested the strategy on Brian's machine, it was OK. Here is the link to my post.

                              Today I did second test on Brian's machine.

                              There are several Print() methods in OnBarUpdate() and in OnExecution(). I can use them to output some values.

                              The main boolean variables are filters for entry orders. I checked the screenshot with order on 06/23 15:59 (link). EnterLong() is executed at 95.635, because the price went above EMA + TriggerOver = 95.633. This order is OK, I just don't know why it is not reported on Orders tab. Let me know what in the code could cause it. It seems that this bar is either first bar of session or last bar of previous session. Maybe this is why the order is not reported on Orders tab?

                              After that, EnterShort() was executed on 06/23 19:00 at 91.655. Logically it is OK, because this price is below EMA - TriggerUnder = 95.597. But I don't see how it is possible to have price 91.655 at this bar, because Low is above 95.

                              This short position later is closed at 102.00 which also seems to be an impossible price.

                              Please let me know what in the code could cause such strange prices so that I know what to check and output.

                              Comment


                                #30
                                Are you using Low[] within the same condition as a call to SetStopLoss(), by chance? I've just discovered an issue with that setup which can cause Low[] to return unexpected values.

                                In terms of debugging, the first thing I would do is to print the values of anything you are using to set your order prices immediately before placing orders. Something like this:

                                if(condition)
                                {
                                Print(Time[0] + "Low[0] + TickSize = " + Low[0] + TickSize);
                                EnterLongLimit(Low[0] + TickSize);
                                }

                                Obviously adjusting as needed to print out the variables and properties that are relevant to where/when/how you are placing orders. This way, you can see the data under the hood that the strategy is working with, which may not necessarilly be what you expect, based on what you are seeing on the chart. The point is to get the strategy to tell you as much as possible about the values that it is accessing and using to place and modify orders, including timestamps to show you the exact sequence of when things are being done.

                                You might consider checking TraceOrders, as well, for even greater detail on how, when, and where orders are being submitted.
                                Dave I.NinjaTrader Product Management

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by NullPointStrategies, Today, 05:17 AM
                                0 responses
                                25 views
                                0 likes
                                Last Post NullPointStrategies  
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                121 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                64 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                41 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                46 views
                                0 likes
                                Last Post TheRealMorford  
                                Working...
                                X