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

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 Skifree, Today, 03:41 AM
        3 responses
        12 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Started by traderqz, Yesterday, 09:06 AM
        5 responses
        32 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by guillembm, Today, 11:25 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by owensd, 04-21-2024, 11:34 PM
        9 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by trilliantrader, 04-10-2024, 09:33 PM
        7 responses
        25 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X