Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Horizontal Line not updating

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

    Horizontal Line not updating

    I have a very simple indicator that draws a horizontal line at the current price.
    Code:
    public class PriceLine : Indicator
    {
    	protected override void OnStateChange()
    	{
    		if (State == State.SetDefaults)
    		{
    			Description = @"Plots a horizontal line at current price.";
    			Name = "PriceLine";
    			Calculate	= Calculate.OnEachTick;
    			IsOverlay	= true;
    			DisplayInDataBox = false;
    			DrawOnPricePanel	= true;
    			DrawHorizontalGridLines = false;
    			DrawVerticalGridLines = false;
    			PaintPriceMarkers = false;
    			ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    			IsSuspendedWhileInactive = false;
    		}
    	}
    	protected override void OnBarUpdate()
    	{
    			Draw.HorizontalLine(this,"CurrentPrice", true, Close[0], Brushes.DarkGray, DashStyleHelper.DashDotDot, 1);
    	}
    }
    I have a chart with 3 data series in 3 different panels. I add the indicator 3 times, once for each data series

    After a while, one or more horizontal lines stop updating (see the dotted line in the middle panel on the first image).

    When I open the indicators panel, it appears the horizontal line that is not updating is not longer connected to a data series (see second image).

    If I reload Ninjascript, everything is fine again.

    Any idea what the problem is?
    Attached Files
    The Trading Mantis
    NinjaTrader Ecosystem Vendor - The Trading Mantis

    #2
    Hello gregschr,

    I am unable to reproduce with the information you provided.

    Are you minimizing the chart at any point?

    What session template do you have applied to your GC?

    Are you changing the primary instrument at any point?

    Are you changing time intervals?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan,

      The problem is rather random, so I am not surprised you have not been able to reproduce it. I also observed this on the ES data series after I submitted the post. I do not recall if I have ever seen this on the primary series.

      In answer to your questions:
      1) I have not minimized the chart at any time.
      2) All three data series are set to "Use instrument settings"
      3) I have not changed the primary series.
      4) I have not changed any intervals.

      I've attached a screen shot of the GC data series properties.

      Thanks,
      Greg
      Attached Files
      The Trading Mantis
      NinjaTrader Ecosystem Vendor - The Trading Mantis

      Comment


        #4
        I was doing some testing using Playback Connection and found another way to reproduce this error easily.

        Whenever I use GoTo to jump ahead to a later date/time, the PriceLine indicator almost always disconnects from the Data Series.

        Also, if you run the connection at 10X during a period of higher liquidity (e.g. US morning), it generally does not take long for the PriceLine to disconnect from the Data Series.
        The Trading Mantis
        NinjaTrader Ecosystem Vendor - The Trading Mantis

        Comment


          #5
          Not sure why I did not check the log earlier, but here is the error that is generated when the data series disconnects from the indicator.
          Indicator 'PriceLine': Error on calling 'OnBarUpdate' method on bar 6185: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
          The Trading Mantis
          NinjaTrader Ecosystem Vendor - The Trading Mantis

          Comment


            #6
            Hello gregschr,

            I was able to replicate on replay and have submitted a bug report.

            Thank you for your report.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Hello gregschr,

              I wanted to update you that it looks like the issue with the horizontal line detaching is slated to be resolved in the next issue of NinjaTrader, V8R9 which you can confirm upon its release by searching 11918 in the release notes. This of course could change but as of now that is what it looks like.

              Thank you.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Thanks for the update Alan.

                A workaround until the next release is to wrap the Draw.HorizontalLine statement in a Try/Catch block. This seems to address the issue as I have not had any problems since doing so.
                The Trading Mantis
                NinjaTrader Ecosystem Vendor - The Trading Mantis

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by alifarahani, Today, 09:40 AM
                6 responses
                29 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                17 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by Kaledus, Today, 01:29 PM
                5 responses
                13 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by Waxavi, Today, 02:00 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by gentlebenthebear, Today, 01:30 AM
                3 responses
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X