Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MultiTimeframe Dataseries smoothing

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

    MultiTimeframe Dataseries smoothing

    Hi, I have a strategy where I am trying to smooth the dataseries of the ADX of a different timeframe. Having a little problem trying to figure out how to use the SMA of a dataseries in a different timeframe. What I have is this (simplified):

    double nADX = ADX(BarsArray(1), 15)[0] ; // ADX in a 5' timeframe
    dsADX.Set(nADX) ; // declared as a Dataseries

    // now what I am trying to do is smooth this with an simple moving average of a higher timeframe.

    double nADXAvg = SMA(BarsArray(1), dsADX, 5) ; // which doesn't work

    I am sure there is a simple fix for this, but I sure can't see it...

    #2
    Hi jrs, please take a look at this reference sample - http://www.ninjatrader-support2.com/...ead.php?t=3572

    Comment


      #3
      Hi Bertrand, I looked at the SampleDataSeries.OnBarUpdate and see where it is indicating using an arbitrary indicator overloaded to sync the primary and secondary DS with. Is this what you meant? As otherwise I don't see where I can get an SMA of a secondary timeframe ADX at. So if I just sync the two (primary and secondary) then run an SMA of the #2 timeframe ADX it will come out correctly?

      if (primarySeries[0] > 0 && secondarySeries[0] > 0)
      double sma_adx2 = SMA(ADX2, 5)[0] ; // this will provide an SMA of the #2 timeframe ADX ?

      Comment


        #4
        Yes, just follow along the sample. First create your dataseries and sync then up in the OnBarUpdate(), this will ensure the references ( [ ] ) to the correct bar for both frames are working.

        Then set your dataseries values with using BarsInProgress to address the correct OnBarUpdate().

        The you should be able to access your SMA ADX and implement further trading logic.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X