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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        54 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        72 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        38 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        99 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        60 views
        0 likes
        Last Post PaulMohn  
        Working...
        X