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 andrewtrades, Today, 04:57 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    6 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    7 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X