Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modified MACD Indicator

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

    Modified MACD Indicator

    As a NOOB NinjaScript guy, I am trying to modify a renamed version of the MACD indicator. Attached is the standard code and I thought that I should be able to change the two PLOT lines:

    Add(new Plot(Color.Green, "Macd"));
    Add(new Plot(Color.DarkViolet, "Avg"));

    to:

    /// Add(new Plot(Color.Green, "Macd"));
    /// Add(new Plot(Color.DarkViolet, "Avg"));

    But now the Indicator doesn't plot anything?

    Thanks.
    Attached Files

    #2
    jtfancher,

    Thank you for your post.

    If you were trying to remove these two plots by commenting them out the add method, there are more changes you would need to make in the OnBarUpdate and Properties section of the code.

    Rather than removing the plots, would it be easier for you to change the Colors to transparent instead?
    Code:
    Add(new Plot(Color.Transparent, "Macd"));
    Add(new Plot(Color.Transparent, "Avg"));
    Last edited by NinjaTrader_Matthew; 07-22-2011, 08:23 AM.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Matthew - thanks. At first I thought no but made a change to the Auto scale field and this worked. Bravo!

      Comment


        #4
        Great to hear!

        Since you're just getting started with NinjaScript, I would suggest keeping a close eye on the log tab of the control center for any errors when adding your project to a chart.

        If you're unable to determine what is causing the errors, you can use try-catch blocks over various segments in your code and that will trap wherever the issue is stemming from.

        Please see our Reference Sample on using Try-Catch blocks to debugg your code:



        Have a great weekend and happy coding!
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 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
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X