Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start and Display AutoTrendLine From Indicator

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

    Start and Display AutoTrendLine From Indicator

    I am writing a custom indicator and I would like to start the AutoTrendLine indicator (that I've downloaded from the forum) from inside my custom indicator. I am starting it in the Initialize() routine using:

    Indicator ind = AutoTrendLine(true, 1,5);

    This compiles and runs without errors, but the trend line does not appear on the chart.

    What am I missing ?

    #2
    Hello BAltman,

    Thanks for your post.

    You will need to create a plot and set the value of this plot to the value of SMA(period)[0].

    For example:

    in Initialize():
    Add(new Plot(Color.Blue, "myPlot"));

    in OnBarUpdate():
    myPlot.Set(SMA(19)[0]);

    Below is a link to the help guide on the Add() method for indicators.
    http://www.ninjatrader.com/support/h...es/nt7/add.htm


    The alternative is to use a strategy and add the indicator which will allow you to add this without creating a custom plot.

    See the help guide on the Add() method for strategies.
    http://www.ninjatrader.com/support/h...s/nt7/add2.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,

      The example code you provided uses the SMA indicator, which is an indicator that plots a data series.

      The AutoTrendLine indicator I want to "add" draws rays and is not set up to return a value based on the current bar.

      Is there another way to get this to work (short of adding the AutoTrendLine code directly into my custom indicator) ?

      Comment


        #4
        Hi BAltman,

        The options here would be to copy the code in to your script, or to use a strategy instead of an indicator.

        Or you could always just add the second indicator to your chart manually.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        629 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        564 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X