Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MA on ROC

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

    MA on ROC

    Hi I'm trying to chart the SMA(5) on ROC(12) but following NT "SMA on Vol Tutorial" on NT Help, just plot the SMAonROC line. In the SMA on Vol plot the volume AND sma.

    How to do the same here?

    protectedoverridevoid Initialize()
    {

    Add(
    new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "Plot0"));
    Add(
    new Plot(Color.FromKnownColor(KnownColor.BlueViolet), PlotStyle.Line, "Plot1"));
    Add(
    new Line(Color.DarkGray, 0, "Zero line"));

    protectedoverridevoid OnBarUpdate()
    {
    double roc = ROC(12)[0];
    Plot0.Set(roc);

    double average = SMA(ROC(12), 5)[0];

    Plot1.Set(average);
    }

    #2
    Hi fercho,

    Thanks for the post and welcome to the NT forums! Your code looks OK and I see two lines plotted when I use this. What issue are you having?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Thanks for reply.

      The mistake was that I setted "Values[0]" in Properties for Plot0 and Plot1

      Thanks, now's working.

      Comment


        #4
        Great, glad you got it working. Thanks for sharing the solution here.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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