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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X