Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Added DataSeries not loading properly in Script

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

    Added DataSeries not loading properly in Script

    I have a script that draws lines based on a Higher time frame Data Series. Today I noticed the lines were missing in the middle of the data. I added some Print Statments and Sure enough It was telling me There was no bars in the middle. So I did a Manual Reload ALL Historical data. And then the lines came back and the print out then agreed the data was that was missing was there. So I then did a Reload NinjaScript and the lines and data disappeared. I believe I am adding the data in the script properly.

    protected override void OnStateChange()

    {
    if (State == State.SetDefaults)
    {
    Description = @"";
    Name = "LP16807SR";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    IsAutoScale = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    IsSuspendedWhileInactive = false;
    LineColor =Brushes.Black;
    Width = 4;
    BarsRequiredToPlot = 14;
    Stroke ibStroke = new Stroke(Brushes.Black, DashStyleHelper.Dash, Width);
    Stroke iyStroke = new Stroke(Brushes.Yellow, DashStyleHelper.Dash, Width);

    }
    else if (State == State.Configure)
    {
    AddDataSeries( BarsPeriodType.Tick, 16807);

    }


    }

    #2
    Hello JerryWar,

    Who are you connected to?

    What instrument and what expiry are you using?

    Do you have a test script with only the necessary code to reproduce the behavior you can export and attach with your next post?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      CL 1-17 NinjaTrader CQG
      no I have no test script only my script. I could write something after market.
      But I doubt it will reliably show anything. I have been seeing random issues like this and not known what has been going on. Since this indicator draws from one Higher time frame bar to another on a lower time frame It is obvious when the lines are missing or Stretched out in time. further I got another error today different script "Object reference not set to instance of object and I am wondering whether its related. That script has been running reliably for a long time. but That I believe I can trap. On reload of script it went away.

      I should also note on my lowest time frame chart yesterday I notice several days back there was a full day of data missing. I forced a reload. There is obviously some issue going on because that data should of filled in on startup.

      And one further note. I had a different chart that added a second time frame in a script. I had occasion to manually add the the data Stream to the chart to see the bars. then when I removed the data stream. The chart labels attached to that second data stream from within the script got all messed up when I removed the manually added data stream. Its like when it was added to the chart the script flipped over to use the manually added data in preference to the Added same series within the indicator. I did a Script reload and it fixed it but I just thought that it was odd.
      Last edited by JerryWar; 12-15-2016, 08:38 AM.

      Comment


        #4
        Hello JerryWar,

        If you are finding an error due to a null object, this should stop your script. I wouldn't expect a gap in the data, I would expect the prints to stop all together.

        Please create a test script with only the necessary code to reproduce the behavior and post this with your next post.

        Also, the CL is trading the 02-17. What is your merge policy set to so that you are seeing data on your chart for the 01-17?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,
          No that is where you guys are all screwed up. You think you can arbitrarily set rollover dates. You can't. Its when traders switch over contracts. If you look at the daily volume in CL 1-17 vs. CL 2-17 the volume is still higher in CL 1-17. I will always trade the contract with higher volume. The CL 1-17 is almost double the volume. See attached . The old rule of thumb was the close of the day on the third Thursday of the month. So tomorrow I will be watching the volume closely. If your servers are doing anything different, its incorrect.
          Attached Files
          Last edited by JerryWar; 12-15-2016, 08:45 AM.

          Comment


            #6
            Hello JerryWar,

            The rules of the rollovers come from the exchange website.
            http://www.cmegroup.com/

            You can choose to rollover whenever you want, but the rollover date that NinjaTrader uses to merge data, has to be set to an exact date, and the date and merge policy has to be set according to the data you want to see.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea
              There is nothing to merge yet. I have not rolled over, So any merging went on a month ago. My data only looks back 3-10 days depending on the chart. It was set to Merge Back adjusted - which is not correct. It must not of got updated after re-installs. It should be Merge Non-Backadjusted.

              Jerry

              Comment


                #8
                Hello Jerry,

                NinjaTrader uses the merge policy and the rollover dates to display data on your chart.

                If the merge policy is merge back adjusted and you are using an expiry contract month after its rollover date (i.e. using the 01-17 expiry when the 02-17 is actively trading), no data will load for that instrument after that date. It will cause missing data from your chart.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Yes of course, which is why your Rollovers are screwed up. If I want to Merge data at all you stop me from receiving data on the most heavily traded contract, Which means traders haven't rolled over into the new contract yet. So your forcing me to make changes to the merge policy I am using each time ( every month ) when you arbitrarily( Cme or not) determine a rollover date. Your merge policy needs another option. Rollover on or after Rollover date based on volume.

                  And why should it be erratic where I force a download and it updates?
                  If I force a manual or otherwise download on data that was rolled over and can't be received you should generate a warning in the log.


                  Jerry

                  Comment


                    #10
                    Hello Jerry,

                    I have submitted a feature request on your behalf for a rollover based on volume option.
                    (As a heads up, NinjaTrader will still need a date to stitch the charts together. A setting such as this will cause different traders who rolled at different dates to have different data on the charts.)

                    I have also submitted a feature request to trigger an error if loading an instrument with an expiry contract month past the rollover date.

                    It is up to development to decide if and when a request will be implemented.

                    Please let me know of any other suggestions or requests you have for the NinjaTrader Platform.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      I earlier set the merge policy to "Do Not Merge" and the data hole just came back. More interesting is that the hole is only happening on the hidden data Series loaded from within the indicator.

                      See attached and notice there are no prints for 12/14. If I again force a Reload Historical It will print for 12/14 as well i.e. the data comes back.
                      Attached Files
                      Last edited by JerryWar; 12-15-2016, 12:15 PM.

                      Comment


                        #12
                        Hello JerryWar,

                        Please let me know if you have a simple script you would like me to test to reproduce the behavior.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          I will email to Your Attn:

                          Comment


                            #14
                            Hello Jerry,

                            Would a script that excerpts the just the bare minimum code necessary to reproduce this behavior, not be something you could share on the forum for the benefit of other coders?

                            (Just a reminder, I do not want your complete script, just the code necessary to reproduce the behavior)

                            If so, please send this in an email to platformsupport [at] ninjatrader [dot] com. In the email please include a link to this forum thread.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_ChelseaB View Post
                              Hello Jerry,

                              NinjaTrader uses the merge policy and the rollover dates to display data on your chart.

                              If the merge policy is merge back adjusted and you are using an expiry contract month after its rollover date (i.e. using the 01-17 expiry when the 02-17 is actively trading), no data will load for that instrument after that date. It will cause missing data from your chart.
                              The above is not true. See the attached chart showing CL 1-17 with current CL 1-17 data coming in while Merge is set to "Merge Back adjusted" Line up the time and price with a CL 2-17 chart and you will see it is not CL 2-17 data, which is the contract that got rollover over to. This is because my chart is set to CL 1-17 so it should not Merge anything and doesn't explain what I was seeing.
                              Attached Files
                              Last edited by JerryWar; 12-16-2016, 08:49 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by stafe, Today, 12:34 PM
                              2 responses
                              20 views
                              0 likes
                              Last Post stafe
                              by stafe
                               
                              Started by asmmbillah, Today, 11:18 AM
                              1 response
                              18 views
                              0 likes
                              Last Post NinjaTrader_ChrisL  
                              Started by nickse2003, Today, 09:56 AM
                              1 response
                              27 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by ATMtrader0001, Today, 10:08 AM
                              5 responses
                              38 views
                              0 likes
                              Last Post ATMtrader0001  
                              Started by WHICKED, Today, 09:47 AM
                              1 response
                              26 views
                              0 likes
                              Last Post NinjaTrader_Spencer  
                              Working...
                              X