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

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
    JesseNinjaTrader Customer Service

    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.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          11 responses
          39 views
          0 likes
          Last Post cmtjoancolmenero  
          Started by FrazMann, Today, 11:21 AM
          0 responses
          5 views
          0 likes
          Last Post FrazMann  
          Started by geddyisodin, Yesterday, 05:20 AM
          8 responses
          52 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by DayTradingDEMON, Today, 09:28 AM
          4 responses
          26 views
          0 likes
          Last Post DayTradingDEMON  
          Started by George21, Today, 10:07 AM
          1 response
          22 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X