Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    -EC_Chris-
    NinjaTrader Ecosystem Vendor - Emergent Cybernetics

    #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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by knighty6508, 05-10-2024, 01:20 AM
    4 responses
    25 views
    0 likes
    Last Post knighty6508  
    Started by OllieFeraher, 05-09-2024, 11:14 AM
    6 responses
    19 views
    0 likes
    Last Post OllieFeraher  
    Started by PaulMohn, 05-02-2024, 06:59 PM
    2 responses
    44 views
    0 likes
    Last Post PaulMohn  
    Started by ETFVoyageur, Today, 02:10 AM
    0 responses
    14 views
    0 likes
    Last Post ETFVoyageur  
    Started by rayyyu12, Today, 12:47 AM
    0 responses
    9 views
    0 likes
    Last Post rayyyu12  
    Working...
    X