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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    46 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    28 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    163 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X