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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        43 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        30 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        47 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X