Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator plotting only 0 for positive/negative values

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

    Indicator plotting only 0 for positive/negative values

    Hello,

    I have a volume-based indicator I have created. The plot is not overlay, and plots in the subplot.

    Everything is working for the plot and the indicator. The issue I am running into is the indicator is set up to calculate both negative and positive values, and it seems because of this, the indicator is only plotting 0.

    When I force the indicator to not plot negative, the indicator works. But when I allow both negative and positive values to calculate, again, the indicator only plots 0.

    Does NinjaScript automatically force a 0 for some instances (say volume based indicators) where it won't plot negative values?

    Is there a way to allow negative values to plot in this circumstance?

    Thanks

    #2
    Hello EC_Chris,

    Thanks for your inquiry.

    NinjaTrader 8 will plot a 0 for invalid data points when NinjaTrader 7 would use the value from input series. This could be for example, when an indicator's OnBarUpdate() method is called and a plot's value is not set for that bar iteration.

    You should still be able to plot negative values for your indicator. You may see that the setting an indicator plot to a positive or a negative does work.

    Code:
    Values[0][0] = (CurrentBar % 2 == 0) ? 10 : -10;
    I may suggest to make sure that the indicator is in fact setting a plot value for that bar iteration. I've also included a link for IsValidDataPoint() that will tell you when an indicator plot is a valid data point before referencing that value.

    IsValidDataPoint() - https://ninjatrader.com/support/help...ddatapoint.htm

    I'm happy to be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    602 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    347 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    560 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    559 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X