Announcement

Collapse
No announcement yet.

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().

    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...

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sjsj2732, Yesterday, 04:31 AM
        0 responses
        38 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        287 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        289 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        134 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        95 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X