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

Displaying ADX and Its SMA on the same plot?

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

    Displaying ADX and Its SMA on the same plot?

    Hello,

    In my strategy code, I am trying to display ADX(18) and It's own SMA on the same plot.... How can I achieve this?

    Adding the first line to the code below correctly displays the 18-Day ADX...as a separate plot under the Price plot.

    However, when I add the second line from below Add(SMA(ADX(18), 18)); the ADX SMA is displayed on the Price Section of the chart rather on the Indicator Plot itself...

    Add(ADX(18));
    Add(SMA(ADX(18), 18));

    I am obviously missing something....

    Do I need to make a copy of the ADX indicator code and add the SMA to the indicator code itself to achieve this?

    Thanks.

    #2
    CyberTrader123, yes please create a custom indicator for the 'SMA of the ADX' and then ADD() this from your strategy Initialize().
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      CyberTrader123, yes please create a custom indicator for the 'SMA of the ADX' and then ADD() this from your strategy Initialize().
      Thanks...If it helps anyone, I made a copy of the ADX indicator, called it ADXwSMA and added the following code....and it displayed the SMA of ADX.

      protected override void Initialize() {
      .....
      Add(new Plot(Color.Red, "ADXSMA"));
      .....
      }


      protected override void OnBarUpdate(){
      .....
      .....
      //Simple Moving Average
      ADXSMA.Set(SMA(Value, Smalength)[0]);
      .....
      .....
      }

      I parameterized the SMA Length using a variable...

      Thanks for the quick response... I really appreciate the timeliness.

      Comment


        #4
        You're welcome, thanks for sharing your solution here...
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by llanqui, Today, 10:29 AM
        0 responses
        4 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by llanqui, Today, 08:32 AM
        1 response
        10 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by lollers, Yesterday, 03:26 AM
        1 response
        53 views
        0 likes
        Last Post lollers
        by lollers
         
        Started by Salahinho99, 05-05-2024, 04:13 AM
        7 responses
        63 views
        0 likes
        Last Post Salahinho99  
        Started by knighty6508, 05-10-2024, 01:20 AM
        4 responses
        30 views
        0 likes
        Last Post knighty6508  
        Working...
        X