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 NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X