Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error with Stochastics indicators

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

    Error with Stochastics indicators

    I was having some errors with the Stochastics values provided by Ninja Trader and tried to create a similar indicator. I wanted to reproduce the behaviour of a Slow Stochastic.

    I could not find a way to compile my Slow Stochastic indicator as I was using the same statement of the Full Stochastics just eliminating one of the input variables.

    Finally I decided to re-compile the existing Stochastics indicator and founf the error in the attached picture. The same error is reported if I try to compile the StocastichsFast indicator

    BTW: I tried to compare the values of the stocastics displayed by Ninja in a chart with the value at barchart.com and found that they are different

    Please let me know how I can resolve this error

    Thanks
    Attached Files

    #2
    Hello agosinv,

    Thanks for your note.

    The error from the screenshot is coming from StochasticsSlow.cs. The code in the screenshot is Stochastics.cs.

    Please open the StochasticsSlow indicator and comment out any .Set lines. Then recompile.

    Please let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      What I am reporting is that when I tried to re-compile the standard Stochastics or StochasticsFast indicators I received the error.
      Can you try that, too?
      This could be the reason why the indicators values don't match what I found on barchart.com or yahoo finance (see attacehd example)
      Thanks
      Attached Files

      Comment


        #4
        My mistake, The error went away after I deleted the Stochastic indicator I created. What is the reason for the different values I reported in the attached pictures?
        Thanks

        Comment


          #5
          Originally posted by agosinv View Post
          My mistake, The error went away after I deleted the Stochastic indicator I created. What is the reason for the different values I reported in the attached pictures?
          Thanks

          If all indicators/strategies don't compile in NT7 or 6.5, you are hosed. I believe this is supposed to change in NT 8 ...

          There was a dividend on 2/28/2013 of 32 cents in TAP.

          That might be the difference with these charts.

          Comment


            #6
            Originally posted by agosinv View Post
            What I am reporting is that when I tried to re-compile the standard Stochastics or StochasticsFast indicators I received the error.
            Can you try that, too?
            This could be the reason why the indicators values don't match what I found on barchart.com or yahoo finance (see attacehd example)
            Thanks
            The indicators do not match because you did not use the proper settings. The calculation of a Slow Stochastics involves 3 steps

            -> calculate fast K for a lookback period (NinjaTrader: periodK)
            -> calculate (slow) K line by smoothing fastK (NinjaTrader: smooth)
            -> calculate (slow) D line by smoothing slow K with the period D (NinjaTrader: periodD)


            With Barchart you have selected

            period % K = 8
            period % D = 3
            The smoothing parameter cannot be adjusted with BarChart.

            In order to obtain the same result with NinjaTrader, you also need to select periodK = 8 and periodD = 3. However, you have inverted those values, which explains the difference.

            If you apply the indicator parameters correctly the panel will show Stochastics(TAP, 3,8,3) and not Stochastics (TAP, 8,3,3).

            Comment


              #7
              YES, that explains it. I just did not realize I was using the paramenters in the reverse order. I automatically used what seems to be the most common order for many other charting software.
              Thanks a lot for the clarification

              Comment


                #8
                I am facing also a problem of discrepancies between the stochastics calculated by NinjaTrader and the one I get on stockcharts,com.
                I am using the following parameters:
                PeriodK: 14
                PeriodD: 7
                Smooth: 7

                I also tried to compare the slow stochastics from Stockcharts with NJ Stochastics with parameters PeriodK: 14, PeriodD: 7, Smooth: 3. Same issue. I constantly get a lower value with NJ.

                Any clue ?
                Please see attached screenshots.
                Attached Files

                Comment


                  #9
                  Hello lillu,

                  While I cannot say why there are differences on how these are calculated (it may be that the data itself is slightly different), you may see all of the code that the Stochastics indicator in NinjaTrader uses to calculate.

                  To view this, click Tools -> Edit NinjaScript -> select Indicator -> select Stochastics -> click OK.

                  You can then compare this code to the code in the other platform.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by lillu View Post
                    I am facing also a problem of discrepancies between the stochastics calculated by NinjaTrader and the one I get on stockcharts,com.
                    I am using the following parameters:
                    PeriodK: 14
                    PeriodD: 7
                    Smooth: 7

                    I also tried to compare the slow stochastics from Stockcharts with NJ Stochastics with parameters PeriodK: 14, PeriodD: 7, Smooth: 3. Same issue. I constantly get a lower value with NJ.

                    Any clue ?
                    Please see attached screenshots.
                    Your parameters are different. Why would you not expect to get different results? (14,7,7) != (14,7,3)

                    Comment


                      #11
                      I'm sorry but I think you misread my post.
                      If you look at the screenshots, I am using 14,7,7 in both platforms, NJ and stockcharts (First stochastics plotted) and I am also comparing the stockcharts slow stochastics (That is actually a stochastics with 3 as a smoothing factor) with a 14,7,3 stochastics in NJ.

                      So, believe me I am really comparing apples with apples....

                      Comment


                        #12
                        I downloaded all daily quotes and did the calculation manually in Excel.
                        I found out that the data between Yahoo (my data feed provider in NJ) and Stockcharts are different prior to 2013-12-23, date when a dividend has been applied.
                        I guess this is the root cause.

                        Comment


                          #13
                          Originally posted by lillu View Post
                          I'm sorry but I think you misread my post.
                          If you look at the screenshots, I am using 14,7,7 in both platforms, NJ and stockcharts (First stochastics plotted) and I am also comparing the stockcharts slow stochastics (That is actually a stochastics with 3 as a smoothing factor) with a 14,7,3 stochastics in NJ.

                          So, believe me I am really comparing apples with apples....
                          You are right. I did misread your post. My apologies.

                          Comment


                            #14
                            Originally posted by lillu View Post
                            I am facing also a problem of discrepancies between the stochastics calculated by NinjaTrader and the one I get on stockcharts,com.
                            I am using the following parameters:
                            PeriodK: 14
                            PeriodD: 7
                            Smooth: 7

                            I also tried to compare the slow stochastics from Stockcharts with NJ Stochastics with parameters PeriodK: 14, PeriodD: 7, Smooth: 3. Same issue. I constantly get a lower value with NJ.

                            Any clue ?
                            Please see attached screenshots.

                            There are several potential reasons that the Stochastics may produce different values:

                            (1) You did not chart the same instrument. After all the instrument is not shown on your screenshot from Stock Charts. NinjaTrader displays an unknown instrument GDX.

                            (2) Different daily data (regular session data vs. full session data, settlement price vs. full session close vs. regular session close)

                            (3) You did not include the last day with NinjaTrader (set indicator to CalculateOnBarClose = false)

                            I have tested the Stochastics from StockCharts against the NinjaTrader Stochastics and can confirm that they produce identical results, if applied correctly.

                            Below are two screenshots for Ford Motor Corporation (daily data). The value displayed for the K-line is 16.78 and for the D-line 12.20, whether you use NinjaTrader or Stock Charts.
                            Attached Files

                            Comment


                              #15
                              stochastics not matching up

                              I agree I use Interactive Brokers and the Slow Stochastics I get with NT are not the same for any charts when compared IB charting software. NJ technicians need to stop dancing around this issue and fix the problem. I will not use NJ as long as this problem persists

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Barry Milan, Yesterday, 10:35 PM
                              4 responses
                              14 views
                              0 likes
                              Last Post Barry Milan  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              4 responses
                              12 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by terofs, Today, 04:18 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post terofs
                              by terofs
                               
                              Started by nandhumca, Today, 03:41 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post nandhumca  
                              Working...
                              X