Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom ADL indicator.

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

    Custom ADL indicator.

    NinjaTrader has ADL indicator. Is it possible to make it when rising line become green and falling become red. Thank you in advance.
    Attached Files

    #2
    Hello yunakhan1,

    Thank you for the question.

    For creating a custom ADL indicator you could follow these steps to accomplish what you are looking to do.

    First to make things easy you can create a duplicate of the ADL that you can edit by doing the following:
    1. From the NinjaTrader Control Center, Click Tools -> Edit NinjaScript -> Indicator
    2. Next Select the ADL and press OK
    3. Now when the NinjaScript Window opens up, Right click and click Save As.
    4. Now give the new indicator a name, maybe ADL2 for example and save it.
    5. The already open NinjaScript window has been switched to the newly created indicator.



    Now that you have your ADL base, you can add the condition to change the color of the plot when it is rising or falling.

    There is an excellent example of the code required in the help guide reference for PlotColors located here: http://www.ninjatrader.com/support/h...plotcolors.htm

    Now in the ADL code, look for the line that says this

    Code:
    AD.Set((CurrentBar == 0 ? 0 : AD[1]) + (High[0] != Low[0] ? (((Close[0] - Low[0]) - (High[0] - Close[0])) / (High[0] - Low[0])) * Volume[0] : 0));
    AD is the dataseries that is being used for holding the ADL's calculated data, AD is what you will need to check if it is rising or falling.

    Right below this line you will want to copy the help guide example so it looks like this:
    Code:
     AD.Set((CurrentBar == 0 ? 0 : AD[1]) + (High[0] != Low[0] ? (((Close[0] - Low[0]) - (High[0] - Close[0])) / (High[0] - Low[0])) * Volume[0] : 0));
            	
    if (Rising(AD))
         PlotColors[0][0] = Color.Blue;
    else if (Falling(AD))
         PlotColors[0][0] = Color.Red;
    else
         PlotColors[0][0] = Color.Green;
    Note in the statement if(Rising(AD))
    I have changed what the example has to reflect the data series in the ADL which is the AD

    Now this is checking if the AD is rising, falling or if not coloring the line Green.

    I have attached the full example in case this is hard to follow.

    Please let me know if I may be of additional assistance.
    Attached Files

    Comment


      #3
      Thank you.

      Comment


        #4
        Thank you NinjaTrader_Jesse. Is it possible in indicator using in a plot style instead of bar line etc using numbers or candlestick or OHLC plot style?

        Comment


          #5
          Hello yunakhan1,

          In an indicator you have access to a few different types of line style that can be used with the Plot. An actual bar style like OHLC or Candle Stick would not be able to be used.

          If you take a look at this document, it lists the available options. Additionally you can view these by applying any indicator that uses a plot, SMA for example and change the type in the indicators properties on the chart.



          Please let me know if I may be of additional assistance.

          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