Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACD line not plotting after change of plot order

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

    MACD line not plotting after change of plot order


    In the attached NT8 MACD script, the line plot order was changed to plot the MACD Differential histogram first, then MACD Average above that, then MACD on top of all. After the plot order change, the Diff histogram and the MACD Average functions and plots as desired, but the MACD line does not plot. I must be missing something simple. Any suggestions? Thank you!
    Attached Files
    Last edited by Lancer; 02-07-2021, 08:53 PM.

    #2
    Hello,

    The AddPlot(Brushes.Red, "Macd"); would generate Values[2].

    I see Macd is returning Values[2].
    public Series<double> Macd { get { return Values[2]; } }

    I don't see anywhere Macd[0] or Values[2][0] is being assigned a value.
    If there is no value assigned, no value will plot..

    The line:
    double Macd = MACD(Fast, Slow, Smooth)[0];
    Makes a localized double value and makes the series inaccessible. Trying using a different name for the local variable within the scope of OnBarUpdate.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB, that was it.

      At AddPlot, changed "Macd" to "MacdValue"
      Changed "Value[0] = Macd;" to "MacdValue[0] = Macd;"
      At Values[2], changed "Macd" to "MacdValue",
      At "double priorMacd = Value[1];", changed to "double priorMacd = MacdValue[1];"

      Now the Macd line plots. Thank you very much!!

      Attached is the working file.
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X