Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries destroys the chart

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

    AddDataSeries destroys the chart

    Hi all,

    I have an issue adding an additional DataSeries. This fully destroys the chart. Have a look at the attached image. Above is ok, below is the destroyed chart.

    Thanks for your help...
    Attached Files

    #2
    Hello Sweet&Sour,

    Thanks for your post.

    The chart is not destroyed as it is still there. What has happened is that it appears the indicator is now being calculated using ^SP500 instead of AAPL. The ^SP500 is around 2900 which is what your indicator is plotting at. Because the indicator has its autoscale set to true, the chart adjusts to show the indicator plots as well as the AAPL dataseries which in this case appears quite small as its typical value is only 185 whilst ^SP500 is at 2900.

    If you want your indicator to only calculate based on the chart bars (AAPL) then in your code you would need to add a line in the OnBarUpdate() such as: if (BarsInProgress !=0) return; however this may not be a satisfactory solution depending on what you want to do by adding the ^SP500 data to your indicator.

    We highly recommend reviewing the helpguide section on multi time frame/multi instrument scripts as there are many considerations when doing so: https://ninjatrader.com/support/help...nstruments.htm

    Comment


      #3
      Hi Paul,

      BarsInProgress != 0 solved my issue.
      I'm just checking afterwards whether or not, the SPX closes for at least 3 bars above the sma50.

      Thanks...

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X