Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATR plot

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

    ATR plot

    I wish to create an indicator that plots a dot on the chart 1 ATR(10) above closing prices. Any suggestion to modify my efforts

    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Dot, "Plot0"));
    CalculateOnBarClose =
    true;
    Overlay =
    true;
    PriceTypeSupported =
    true;
    }
    protectedoverridevoid OnBarUpdate()
    {
    Plot0.Set(Close[0]+ATR(10));
    }

    #2
    You want to use ATR(10)[0] instead to access the latest ATR value.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      ATR Plot

      That works well. Thanks. I tried to plot a second plot but got error.
      Can I do this or do I need to create a new indicator?

      protected
      overridevoid Initialize()
      {
      Add(
      new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
      Add(
      new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
      CalculateOnBarClose =
      true;
      Overlay =
      true;
      PriceTypeSupported =
      true;
      }
      protectedoverridevoid OnBarUpdate()
      {
      Plot0.Set(Close[0]+ATR(10)[0]);
      Plot1.Set(Close[
      0]-ATR(10)[0]);
      }

      Comment


        #4
        To add a second plot you need to add it into the Properties region of the code as well. Please expand the properties region and duplicate a second set you have down there. You will need to increment the Values[0] to Values[1]. I suggest you open up the MACD indicator and take a look at how it is done there.
        Josh P.NinjaTrader Customer Service

        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