Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Missing Plot Values in Market Analyzer

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

    Missing Plot Values in Market Analyzer

    I have a custom indicator that has 3 plots:

    AddPlot(new Stroke(Brushes.Orange, 2), PlotStyle.Dot, "Buystop");
    AddPlot(new Stroke(Brushes.Tomato, 2), PlotStyle.Dot, "SellStop");
    AddPlot(new Stroke(Brushes.Chocolate, 2), PlotStyle.Dot, "Shares");

    I'm setting the values like this:
    Value[0] = BuyPrice;
    Value[1] = SellPrice;
    Value[2] = Qty;

    I'm trying to display these values in Market Analyzer. The only one that is working is Value[0] = BuyPrice

    The other values always display 0

    Print statements will show the correct numbers of Value[1] and Value[2]

    What am I missing?

    #2
    Hi.

    Value is always the very first plot. Hence now you setting values to Buystop plot only, but 0, 1 and 2 barsAgo.

    The code you need:

    Code:
    Values[0][0] = BuyPrice;
    Values[1][0] = SellPrice;
    Values[2][0] = Qty;
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Hello Kentoes,

      Thanks for your post.

      Forum member fx.practic's response is correct.

      When you have one plot you can use the singular Value[0] Using Value[1] would actually be assigning a different value to the previous bar element, Value[2] the bar before that, etc.

      When you have more than one plot, you can refer to the first added plot as Value[0] if you wish, however it is better practice to use the "plural" of Value which is Values[][] where the first index[] is the number of the plot (in order as shown in the State.SetDefaults) and the 2nd index is the specific bar.

      Personally, I prefer to use the name of the plot as this way there is no misunderstanding of what you are assign a value to, for example:

      Buystop[0] = BuyPrice;
      SellStop[0] = SellPrice;
      Shares[0] = Qty;


      You can see an example of this in the Ninjatrader indicator "Bollinger"


      Comment


        #4
        Resolved. Thanks to both of you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        72 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        152 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X