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 funk10101, Today, 12:02 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by GLFX005, Today, 03:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by nandhumca, Yesterday, 03:41 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by The_Sec, Yesterday, 03:37 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by vecnopus, Today, 06:15 AM
    0 responses
    1 view
    0 likes
    Last Post vecnopus  
    Working...
    X