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 CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        23 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        17 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        182 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        335 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        259 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X