Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Rapine Heihei, Today, 08:19 PM
        0 responses
        1 view
        0 likes
        Last Post Rapine Heihei  
        Started by f.saeidi, Today, 08:01 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        4 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Working...
        X