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

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?
    BertrandNinjaTrader Customer Service

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

        Comment


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

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

              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 usazencort, Today, 01:16 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post usazencort  
                    Started by kaywai, 09-01-2023, 08:44 PM
                    5 responses
                    603 views
                    0 likes
                    Last Post NinjaTrader_Jason  
                    Started by xiinteractive, 04-09-2024, 08:08 AM
                    6 responses
                    22 views
                    0 likes
                    Last Post xiinteractive  
                    Started by Pattontje, Yesterday, 02:10 PM
                    2 responses
                    21 views
                    0 likes
                    Last Post Pattontje  
                    Started by flybuzz, 04-21-2024, 04:07 PM
                    17 responses
                    230 views
                    0 likes
                    Last Post TradingLoss  
                    Working...
                    X