Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need Help- Same Output with different DataSeries

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

    Need Help- Same Output with different DataSeries

    Hi There,

    Below you will find a little Indikator. It Plots the ATR and StdDev, to give a hint for Trend / No Trend.

    If you switch on the Smooth-Option, both Lines will smoothed with an EMA, the Code is like this

    dstddev = EMA(StdDev(period), smoothperiod)[0];
    datr = EMA(ATR(period), smoothperiod)[0];

    (---> for more details see the .zip File below):

    THIS DID NOT WORK - The Data of the second EMA are identical to first EMA.

    How can I solve this problem?

    Best
    Trendseek
    Attached Files

    #2
    Trendseek, have you tried just plotting either value alone, does this calculation then hit home as you would expect?

    Comment


      #3
      Hello Bertrand,
      thanks for your fast response!

      I just try it out - it is very easy to modify the Code below in that way.
      The calculation works as expected if it only plotting one instead of two values.
      It also works, if it use two different averages for smoothing the values (i.e. EMA for the StdDev and SMA for the ATR).

      I am just a Beginner with C#, but perhaps it is because of the lokal visibility of the used EMA-method (or better: the data.set, using by that method)?
      I supose, that the first with EMA smoothed Dataline will be overwritten with the second One.

      regards from Germany
      Trendseek

      PS: I am using the actual Ninjatrader 7 Version.

      Comment


        #4
        Thanks for reporting this in, I saw the same issue on my end and we're looking into.

        Comment


          #5
          Trendseek, thanks for the sharp eye and for reporting, this will be fixed in the next beta round.

          Comment


            #6
            Hello Bartrand,

            thanks again for your quick answer - this are good news, and I will looking forward to the next Update :-)

            I made verry bad experiences with serious problems like this in other Trading-Solutions (the german software Tradesignal). This positiv Response will affirmed my decision, to work a little longer with the Ninjatrader.

            Greetings from good old Germany
            Torsten

            Comment


              #7
              You are welcome Torsten, this will be fixed in the next NT7 update, however your code works with no issues in the current production release of 6.5.

              Comment


                #8
                Originally posted by Trendseek View Post
                ...perhaps it is because of the lokal visibility of the used EMA-method (or better: the data.set, using by that method)?
                I supose, that the first with EMA smoothed Dataline will be overwritten with the second One...
                Trendseek,

                EMA(...) is a method which is provided by a NT cache-mechanism. That approach checks the signature of EMA() to select the correct indicator instance. You could try something else, if you like:

                private EMA ema1, ema2;
                private StdDev stddev;
                private ATR atr;
                ...
                protected override void Initialize()
                {
                atr = ATR(period;
                stddev = StdDev(period);
                ema1 = EMA(atr, smoothperiod);
                ema2 = EMA(stddev, smoothperiod);
                }
                ...
                datr = ema1[0];
                dstddev = ema2[0]

                This approach selects the indicator instances explicitely.

                Regards
                Ralph

                Comment


                  #9
                  Hello Ralph,

                  thanks for your helpfull advice!

                  beside, that this problem was fixed in the new Beta, I will definitely give them a try - i like that manner of Variable-Declaration ;-)


                  Regards
                  Torsten

                  Comment


                    #10
                    Hello Torsten,

                    and this approach (explicit indicator declaration) executes faster because it skips the cache look-up procedure.

                    Regards
                    Ralph

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cmoran13, 04-16-2026, 01:02 PM
                    0 responses
                    51 views
                    0 likes
                    Last Post cmoran13  
                    Started by PaulMohn, 04-10-2026, 11:11 AM
                    0 responses
                    31 views
                    0 likes
                    Last Post PaulMohn  
                    Started by CarlTrading, 03-31-2026, 09:41 PM
                    1 response
                    165 views
                    1 like
                    Last Post NinjaTrader_ChelseaB  
                    Started by CarlTrading, 04-01-2026, 02:41 AM
                    0 responses
                    100 views
                    1 like
                    Last Post CarlTrading  
                    Started by CaptainJack, 03-31-2026, 11:44 PM
                    0 responses
                    160 views
                    2 likes
                    Last Post CaptainJack  
                    Working...
                    X