compare stochastics on different charting software

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:

We are here to help. Just let us know what you need.

We work extremely hard to keep things positive in our community.

We do not tolerate rude behavior, trolling, or vendors advertising in posts.

We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.

We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple.

compare stochastics on different charting software

hi,
i have been working on getting the stochastics from ninja and a charting software i have used for a long time, called Ensign, to coincide..,

the names of the parameters are slightly different. for example, Ensign uses %d, %k, and bars, where as Ninja uses period D, period K, and smooth for its parameters.

in the screenshot attached of the two charts side by side, ninja is on the left, Ensign is on the right, it can be seen in the first subwindow of each chart that the two stochs are lining up quite well..... the parameters i am using are the same and so they should be lining up,

because Ensign and Ninja use different terminology in the indicator properties, it took me a while to sort out, but i think i have that down, I spoke with the creator/programmer of ensign and he said that there is nothing special or unique to the code he uses for the stochastics..

but on the bottom subwindow of each chart, the two stochs dont quite match up. and the only change i have done to both stochastics parameters is change the pricetype parameter to "typical" (thanks to eDanny) in ninja which is the same as (H+L+C)/3 in Ensign.

so can anyone see what would be causing these two stochastics on these two charts not to line up on the bottom subwindow? clearly there is a difference in the calculation somewhere, but i am not seeing where that could be. granted the bottom subwindow stochastics are pretty close on each chart, the Big difference i see that i do want to replicate in the ninja chart is the ensign stoch swings to higher/lower extremes when i have the pricetype set on (H+L+C)/3, but when the pricetype is set to close, then the two stochs on each chart line up.
for example, at time 11:39 there is a high and i put a red arrow on each chart. you can see that the stoch in the left chart- lower subwindow is decked at 100, but the left chart- lower subwindow is only at about 85.

at this point this may be an exercise rather than a necessity.
but i would sure like to know if/where there is a bug?
thanks

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

Interesting. I would be helpful if the Ensign code for that indicator could be pasted to a .txt file so we could see just what the difference might be.

the use of different smoothing methods is not only a problem of the stochastics, but also of the RSI. I can give you a nice example of this. In his book "New Concepts in Technical Trading Systems" J.Welles Wilder Jr. presents the RSI. On page 65, you will find "The Relative Strength Index Equation", where he explains the RSI formula by using a simple moving average. On page 66 you will find his handwritten daily worksheet, where he used exponential smoothing. The explanation? The book was published in 1978, the guy did not have a computer. The recursive formula for the EMA just uses yesterday's value of the moving average and today's close - much faster, if you have to calculate this by hand.

So some software developpers applied what the master taught and the others applied what he did, and since you have different smoothing methods used for the RSI. I think it is similar for the Stochastics. Take what you like or code what suits your style.

I think the following problem might be more serious (copy from a post on the NT forum), does anybody know an answer?

Would like to explain here an interesting little bug in the stochastics indicator. I found that the value of the stochastics indicator sometimes exceeded +500, and here comes the explanation.

Line 57 checks a double value for 0. This is should never be done, if the double value is calculated, because the accuracy of the float is limited to about 15 digits.

Even worse, the value that is checked for 0, is the result of a recursive data series SUM. If you look, how SUM works, it adds and subtracts a value for every bar. So in case that SUM() should become 0, it carries an error of all the past additions and subtractions for the DataSeries. For a 1min chart with a lookback period of 65 days there are about 140,000 operations performed with all the errors from the float adding up. So if 1 operation yields an error of about 1 E-15, the recursive mechanism of SUM() increases this error hundred- or thousandfold to 1 E-12. I have actually tested this.

In case SUM(nom,Smooth) and SUM(den, Smooth) both should take the value 0, they may actually have a value of Close[0]*1 E-12. Checking for 0 then returns false, and the Stochastics may jump to +500 or below -300, as observed. So to be on the safe side, the formula for the Stochastics indicator should be modified, either by using an appropriate Almost Equal method which can be used to replace the offensive code, or by simply replacing line 57 with

thanks both of you for a reply.
yes, i would like to compare code. not sure if the ensign code is available.
may be i will just use the ninja stoch, it is pretty close..

Raw stochastic is the percentage of where a price is in a range of highest high - lowest low over a set of bars. Some call the raw value Fast %K.
Raw Stochastic = 100 * (Last - LowestLow) / (HighestHigh - LowestLow).
Slow %K is an average of the Raw Stochastic. Some call this first average Fast %D.
Slow %D is an average of the Slow %K. This is the 2nd average.
Ensign Windows has 4 choices of which formula to use for calculating the averages. The average used for the original Stochastic work was an exponential moving average. However, variations using simple average, weighted average and smoothed average are also worthy and useful Stochastic calculations.

The smoothed average formula is very similar to the exponential formula. The difference is in how the Alpha decay factor is derived from the average parameter N. See these formulas:
Exponential = Previous Average + ((Current Value - Previous Average) / Alpha)
where Alpha = (N+1)/2
Smoothed = Previous Average + ((Current Value - Previous Average) / Alpha)
where Alpha = N
The parameter N is greater than or equal to 1. If the parameter entered is less than 1, then invert the parameter using N = 1 / parameter.
Ensign Windows does not do a 3rd average. If an average of the Slow %D is wanted, then put on a moving average study and set its Data Point to be the %D value of the Stochastic study.

Thanks Fat Tails,
i had seen that "Stochastics Studies on fundamental behavior" on Ensign before but re-reading it shed light on many things, it ties several trading topics together.

i received a great reply back from Howard at Ensign after submitting a well constructed question. his personal attention is one thing that keeps me a subscriber. if i read his answer correctly, he believes the calculations are different when using the value of (h+l+c)/3, ninja uses the higher high and lower low of the price data, and ensign is using the higher high and lower low of (h+l+c)/3 values.. and that is the difference if i understand his reply.
i paste his answer here, tell me if that is what you think? I think their use of Typical being HLC/3 is that the C part of their Stochastic equation is replaced with HLC/3 and they continue to use Highest High and Lowest Low based on bar highs and bar lows. That is why their typical is VERY similar to the regular Stochastic using C.

Sto =100 * (C - LL) / (HH - LL) where C is the price to use, HH is the Highest High in the period and LL is the Lowest Low in the period.

What happens in Ensign is this. When you have Close as the data point, then we do the above of C is the Close, HH is the Highest High, and LL is the Lowest Low.

For ALL OTHER DATA points, we change HH to the be the Highest DATA POINT, and LL is the Lowest DATA POINT in the period. So our HH is the Highest HLC/3 value and LL is the Lowest HLC/3 value. HH from HLC/3 will be a lower value than HH from Highs, and LL from HLC/3 will be a higher value than LL based on Lows. Therefore, our stochastic of HLC/3 can more readily approach 0% and 100%, and swing to the extremese that their implementation will not.

so maybe you, eDanny, or somebody else knows an easy way to implement this method into ninja?

Last edited by traderTX; April 17th, 2010 at 01:53 PM.
Reason: spelling

that is an unorthodox implementation of the Stochastics, but it turns out a valid oscillator. Here is the implementation for NT 7. The formula uses the High and Low of the input value over the period, as explained by Howard.

Joined is a chart of CL 06-10 with the original and the modified indicator (for NT 7.0) , and the indicator file.

Last edited by Fat Tails; April 18th, 2010 at 03:49 PM.
Reason: this indicator works on NT 7.0 only

The following user says Thank You to Fat Tails for this post:

errrr,
i tried importing it but i am still on 6.5 and it didnt seem to import.
if i upgrade to 7.0, will i lose some of the indicators that i have now for 6.5 ?
or do most 6.5 indicators work on 7.0 but not vice versa?

or should i just ask if you can do the indicator so it will work on 6.5?

Below is a version of the ModifiedStochastics for NT 6.5. It uses simple smoothing for the %D line (tell me if you prefer something different). You need to set it to Tpyical via indicator dialogue to get the stochastics indicator described by Howard. It also will give a different value with the close.

Many NT 6.5. indicators work on NT 7.0 and many do not. Each indicator needs to be tested for NT 7.0, as there is a number of code breaking changes that may prevent it from working properly. NT 7.0 indicators can generally not be used with NT 6.5.

The following user says Thank You to Fat Tails for this post: