Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MultiTime Frame Bar Problem

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

    MultiTime Frame Bar Problem

    I am hoping in trying to debug your automated strategies some of you might have run across this problem before. I will describe this issue by using an example.
    Picture two charts , One with a Primary data series of 100 ticks the second chart has a primary data series of 50 ticks and with a secondary data series added via indicator of 100 ticks - all using the same symbol. The two data series of concern are the Primary of 100 ticks on one chart and the secondary of 100 ticks on the second chart. What is happening is that the data series are getting out of synchronization between the two charts. Just like if the Tick bars for each chart did not start building at the same point. i.e. the opens and closes are different, the hi's and lo's are different depending on the bar you compare. This does not happen all of the time. Only on certain days and then after resetting overnight the problem seems to disappear. So I have several questions if anyone can help.
    1) I was under the impression that if you added a data series that was already used somewhere, that ninja did not build a second copy in its data base. it just used what it knew it already had. Is this understanding correct ?
    2) Can anyone explain the cause and / or fix for this problem. I can see where this would drive anyone nuts trying to verify automated trades on a multi time frame system by looking at a second chart with bars displayed for visual verification.

    Thanks for any Help
    Jerry

    #2
    Hello JerryWar, and thank you for your question.

    Would it be possible for you to provide a stripped down version of the second strategy you are using for testing? One thing to be very careful of with strategies is to make sure you are using BarsInProgress correctly. Assuming you are doing so, and you are only accessing timestamps from your secondary series, I may be able to make some recommendations using the OnMarketData override with a copy of your strategy.

    I look forward to assisting further.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hi Jessica
      Thanks for Responding. This is an issue which we touched on before where I had suspicion that BarsInProgress was not being processed properly. Essentially because my Root Series and Secondary Series etc are all multiples of each other and my code assumed the lower TF was completed and processed first, I was experiencing issues with my code where Things were being missed that should not of been. So Fast forward to tuesday where I put a Doji indicator on The primary 343 Tick series of one chart and a Similar Doji indicator on a Secondary Series which was 343 Tick and to my suprise on that tuesday I was not seeing the same Doji's on both charts. The 343 Tick bars were clearly out of sync and they didn't close at the same time. So there respective Hi's Lo's , Opens , Closes were all skewed. My Code is not yet ready to turn into a strategy. It is still an indicator but with a Strategy in mind. My BarsInProgress is processed as a Switch(BinP) with Case Statements to keep everything properly in order. I will set it up with the same framework to eliminate all my code with the exception of the Doji. I can't do that until this weekend. When the sync misfires next time I will also get pictures and send them as well. I don't really see how its possible that it is my code. Also I have posted some pics of the two charts. One looks expanded because it has the root 49Tick series. The other has a Root 343 but the Doji's are both on the 343 Tick. The boxes in the Background on 49Tick chart are an outline of the 343 Tick bars. This along with the Doji's is how I knew they were wrong. They are correct however on these pics.

      Jerry
      Attached Files

      Comment


        #4
        Hi Jessica, I kind of stumbled upon what I believe is the problem. It is an issue that I have been staring at for years with NinjaTrader. I also know that many others have seen this exact same issue. What I believe happens is that NinjaTrader transmits to a script an incorrect Tick. For this example CalculateOnBarClose ==false. This causes the script to react to the tick and then all gets back to normal except the candles on the screen are wrong. For years I have seen Candles appear on the screen that I knew were wrong. Highs, Lows too high etc. out of character for the market. Reloading ninja script would correct the bars. I believe it is this same behaviour that is causing my code to experience other issues.
        This example was done with replay. Note the last Red candle. The body outline is High 47.65 Low 47.59. Now look at the data box which is set on this bar. If I reloaded it would reset to what the data box indicates. See attached after Reload. Now possibly I am making some consistent error in my code. I also attached the code for the candle bar coloring. How do I fix This.

        Jerry
        Attached Files
        Last edited by JerryWar; 08-21-2016, 09:38 AM.

        Comment


          #5
          Hello JerryWar,

          If you believe Ninja has incorrect internally recorded data, you can reset your cache and database as follows. This method will preserve a copy of your existing database for later use and review

          Code:
               * Shut down NinjaTrader 7
               * Delete the contents of your (My) Documents\NinjaTrader 7\db\cache folder
               * Copy your (My) Documents\NinjaTrader 7\db\NinjaTrader.sdf file to (My) Documents\NinjaTrader 7\db\NinjaTrader.22AUG16.sdf
               * Restart NinjaTrader
               * Ensure you remain disconnected
               * Tools -> Options -> Data
               * Reset DB
               * Yes
               * OK
               * Reset Instruments
               * Yes
               * OK
               * OK
               * Restart NinjaTrader 7
          If this is not effective or there are any other question we may answer please let us know.
          Last edited by NinjaTrader_JessicaP; 08-22-2016, 06:30 AM.
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            Jessica,
            That is not what I am saying. that is proven by data window that Ninja has the data correct and by the fact when you reload the candle corrects itself. What I am saying is that for some reason Ninja sends sends incorrect data to its scripts which results in the things like the Incorrect Candle Bar in the picture I sent. If it were incorrect in the cache It would not be fixed on reloading the script. Also I replayed the same data at least 5 more times and was unable to reproduce the bad candle. I need to know
            1) Whether there is anything wrong with the Candle drawing code I sent.
            2) If not, How to protect against this occurring in my code.
            This problem has transcended several computers and Moving from XPx64 to Win7x64. I feel like I am hitting a wall with this issue as it gives me temporary false indications in many parts of my code.

            Jerry

            Comment


              #7
              Hello JerryWar,

              I will be happy to assist further. It would help me to help you considerably if I could see the same thing on my computer, under controlled conditions, that you are seeing on your computer. A C# file which reliably causes what you are describing would help immensely. If this can not be provided for any reason, please send me your log and trace files so that I may look into what occurred.

              You can do this by going to the Control Center-> Help-> Mail to Platform Support.
              Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.
              Please reference the following ticket number in the body of the email: 1559450 . Please also mark this Attn:NinjaTrader_JessicaP


              When I add 2 data series to a script I write, I am not seeing the same thing that you are describing.
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Jessica
                I sent you code and logs and never got a response. Today I have the same issue and I should note there are no errors in the logs. See attached Picture and look at the Large Green Candle. When you look at the data box it says the Bar is only 3 ticks, Yet it says the close is Higher than the High of the bar. The High was not at the close as I watched this bar form.

                Jerry
                Attached Files

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by helpwanted, Today, 03:06 AM
                1 response
                12 views
                0 likes
                Last Post sarafuenonly123  
                Started by Brevo, Today, 01:45 AM
                0 responses
                9 views
                0 likes
                Last Post Brevo
                by Brevo
                 
                Started by aussugardefender, Today, 01:07 AM
                0 responses
                5 views
                0 likes
                Last Post aussugardefender  
                Started by pvincent, 06-23-2022, 12:53 PM
                14 responses
                242 views
                0 likes
                Last Post Nyman
                by Nyman
                 
                Started by TraderG23, 12-08-2023, 07:56 AM
                9 responses
                387 views
                1 like
                Last Post Gavini
                by Gavini
                 
                Working...
                X