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

Stochastic over indicator

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

    #16
    With regard to K and D Stochastics values outside of a 0-100 range,

    This behavior was confirmed on our end. We will be investigating this further. Please keep an eye on the NinjaTrader 8 Release Notes page for updates and bugfixes.





    Tracking ID: NTEIGHT-11194
    Jessica P.NinjaTrader Customer Service

    Comment


      #17
      Hello manugarc,

      This behavior has been observed to no longer occur in the latest version of NT8. The attached scripts were used to test through the Strategy Analyzer. Please let us know if you observe this behavior continuing into the latest version of NinjaTrader.
      Attached Files
      Jessica P.NinjaTrader Customer Service

      Comment


        #18
        Hi Jessica,

        I'm currently using NT8 v. 8.0.4.0, which is the one I was using during the session showed in the screenshot I sent; I've looked for newer versions but it seems to be the last one, am I wrong?

        Comment


          #19
          You are correct. Please compare the version of the stochastics indicator I attached in my previous reply to the one on your system. Please also let us know if this persists into the 8.0.5.0 release.
          Jessica P.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_JessicaP View Post
            You are correct. Please compare the version of the stochastics indicator I attached in my previous reply to the one on your system. Please also let us know if this persists into the 8.0.5.0 release.
            8.0.5.0? I do not see any release information about it.

            Comment


              #21
              I apologize for the lack of clarity. To clarify, I have access to newer, in-development versions of NinjaTrader, and when I was testing using one of these versions, the behavior you and I observed stopped occurring in these versions. When the next version of NinjaTrader is released, what you observed with regard to K and D out-of-range values should be fixed. If this is not the case, please let us know so we can track down why.
              Jessica P.NinjaTrader Customer Service

              Comment


                #22
                Hi Jessica,

                No problem; I understood v 8.0.5.0 was still being developed.

                And yes, the code you posted is the same I have on my indicator (obviously without the exceptions catching).

                I think the problem could be either on the internal processing of [0] and [1], regarding with some kind of race condition, or more probably in the coding of "ApproxCompare()" function. I had similar problems developing other platforms, but I guess in this case is more related to the function mentioned.

                I'll wait anxiously v 8.0.5.0 (Please test it using the stochastics on another indicator, such as a SMA, as mentioned on previous posts, not just with OHLC series).

                Thank you for your time.

                Comment


                  #23
                  Hello Jessica,

                  I think the that the thread so far missed an important point.

                  With NinjaTrader 8 there has been a major change in the architecture. The difference with respect to NinjaTrader 7 is that

                  -> NinjaTrader 8 does not remap Open, High, Low, Close, Typical, Median and Weighted to Input, when an indicator is applied to another indicator

                  -> while NinjaTrader 7 remapped everything to Input.

                  I believe that the new architecture is by far superior to the old one, but it has the implication that the code for all indicators that call Open, High, Low, Close, Typical, Median and Weighted needs to be adapted to allow for applying the indicator to an input series other than price. I have discussed this issue with ChelseaB, and it is been tracked as #SFT-1606.

                  In fact the following indicators cannot currently be used with an input series other than price, because they do not remap the DataSeries to Input as needed.

                  - ADX
                  - ADXR
                  - Aroon
                  - Aroon Oscillator
                  - ATR
                  - CCI
                  - DM
                  - DMI
                  - Double Stochastics
                  - Parabolic SAR
                  - RVI
                  - Stochastics
                  - Stochastics Fast
                  - Ultimate Oscillator
                  - WilliamsR

                  The code of these indicators needs to be adapted to allow for using them with an indicator as input series.

                  When the Stochastics is used on an input series other than price, it will simply return the Stochastics calculated from price, totally ignoring the selected input series. I have coded a sample Stochastics here that allows for selecting a different input series.

                  Comment


                    #24
                    Thank you for this additional information Harry. My colleague NinjaTrader_ChelseaB is currently out of the office. I will review SFT-1606 with him upon return, and ensure that the behavior we discussed with respect to stochastics producing out-of-range values remains corrected while SFT-1606 is implemented.
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #25
                      Hello Harry,

                      Actually I used a modified code, replacing OHLC values with "Input" (as I pointed on my first post) and it failed too. I can't say your code will also fail, but I'm pretty sure it won't fix the problem.
                      Last edited by manugarc; 02-20-2017, 03:46 PM.

                      Comment


                        #26
                        Hello manugarc,

                        If you look at the code of the Stochastics, it is definitely impossible that fastK returns a value outside the boundaries [0,100]. I think we are safe to assume that fastK works correctly.

                        This means that the problem arrises when fastK is being smoothed with the SMA. The SMA uses a recursive formula. The recursive formula calculates much faster than the standard formula (adding up the last N values and dividing them by N), but is more sensitive to error propagation, as rounding errors are adding up.

                        As we take into account the SMA formula, there are basically two possible source for an error.

                        (1) If you use the Stochastics with a period larger than 256, the value of fastK is not defined 256 bars ago, unless you set all Series to MaximumBarLookBack.Infinite.

                        In order to avoid that problem, you should change the code to:

                        Code:
                        den = new Series (this, MaximumBarsLookBack.Infinite);
                        nom = new Series (this, MaximumBarsLookBack.Infinite);
                        fastK = new Series (this, MaximumBarsLookBack.Infinite);
                        (2) In case that you use small bar periods, for example 30-tick bars or similar, the problem of the shift maybe caused by the error propagation properties of the recursive SMA. In this case I would suggest to replace the SMA with a conventional SMA that calculates the current value by adding up the last N values of fastK and dividing them by N.

                        Again, solution (1) is applicable in case that you used a period larger than 256. Solution (2) is applicable in case that you used the Stochastics on a high resolution chart over a longer time period.

                        Can you reproduce the problem?

                        Comment


                          #27
                          Hi Harry; I'm sorry I haven't had time to check that; you may be right, but that code would highly overload the processor, using trys and catchs on each tick, beside the multiple checkings. Thank you for the idea anyway.

                          Comment


                            #28
                            Hi NinjaTrader_JessicaP,

                            I'm trying version 8.0.5.0 and now Stochastics always use price as input, ignoring the inputs I set (as other indicators instead of the price itself), Am I doing something wrong?

                            Thanks in advance.

                            Comment


                              #29
                              Originally posted by manugarc View Post
                              Hi NinjaTrader_JessicaP,

                              I'm trying version 8.0.5.0 and now Stochastics always use price as input, ignoring the inputs I set (as other indicators instead of the price itself), Am I doing something wrong?

                              Thanks in advance.
                              I have explained in post #23 of this thread that the Stochastics and other indicators cannot be used with any input series other than price. These indicators need to be recoded. This has nothing to do with NT 8.0.5.0.

                              - ADX
                              - ADXR
                              - Aroon
                              - Aroon Oscillator
                              - ATR
                              - CCI
                              - DM
                              - DMI
                              - Double Stochastics
                              - Parabolic SAR
                              - RVI
                              - Stochastics
                              - Stochastics Fast
                              - Ultimate Oscillator
                              - WilliamsR

                              Here is a link to a modified Stochastics.

                              http://ninjatrader.com/support/forum...81&postcount=6

                              Comment


                                #30
                                I have explained in post #23 of this thread that the Stochastics and other indicators cannot be used with any input series other than price. These indicators need to be recoded. This has nothing to do with NT 8.0.5.0.
                                This is not what we observed in our testing on our end.

                                So that I may have a more complete picture of what is happening on your end, would it be possible to use the freely and publicly available screen capture software Jing, https://www.techsmith.com/jing.html , or a similar program which can record video of what is happening on your screen, so that you can show me what is occurring on your end? These quick instructions can get you started with Jing.

                                1. When you start Jing, a yellow half circle will appear near the top of your screen. Please hover over it with your mouse
                                2. A small + sign will extend out of this half circle. Please click on it
                                3. When your cursor becomes two intersecting lines, please click and drag your mouse over an area of your screen you would like to record
                                4. Please press the film strip button that appears to begin recording
                                5. When you are finished recording, please press the square stop button that appears
                                6. Please press the share button that appears. It consists of three vertical upward pointing arrows.

                                You will then have the option to view your video on screencast.com . This is the link which can help me diagnose what is happening on your end. It is possible you will need to set up a free account in order to share videos.




                                Thank you very much in advance for providing us with this information. If this procedure is not an option for you, or if there are any other questions we can answer, please let us know.
                                Jessica P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by algospoke, Yesterday, 06:40 PM
                                2 responses
                                18 views
                                0 likes
                                Last Post algospoke  
                                Started by ghoul, Today, 06:02 PM
                                3 responses
                                14 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by jeronymite, 04-12-2024, 04:26 PM
                                3 responses
                                44 views
                                0 likes
                                Last Post jeronymite  
                                Started by Barry Milan, Yesterday, 10:35 PM
                                7 responses
                                20 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by AttiM, 02-14-2024, 05:20 PM
                                10 responses
                                180 views
                                0 likes
                                Last Post jeronymite  
                                Working...
                                X