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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        162 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X