PDA

View Full Version : Stochastics vs Fast Stochastics Indicator


KBJ
10-16-2007, 03:04 PM
In looking at the source for the Stochastics.cs and the StochasticsFast.cs indicators, I notice that one of them is backwards from the other.

The green plot ("D" line) on the StochasticsFast indicator it has the exact same shape as the orange plot ("K" plot) on the Stochastics indicator (see attachment.)

This matters if you're following a strategy that says trade if the sto. goes under 80, or over 20, since you wouldn't want to use the wrong one.

Which one is correct?

Best regards,

KBJ

NinjaTrader_Ray
10-16-2007, 03:16 PM
I don't recall info on the intepretation of the stochastic indicators but both plots are likely identical in calculation and thus they are both correct in the context of their indicator.

KBJ
10-17-2007, 02:46 PM
Ray,

Thanks for looking at this.

I checked the NinjaTrader help which refers to StockCharts and MarketScreen documentation on Stochastics which somewhat explained this for me.

A better and more complete explanation of these differences between the fast and regular Stochastics may be found at http://anuhelix.com/books/Wayne%20A%20Thorp%20-%20When%20to%20Buy%20&%20Sell%20Using%20the%20Stochastic%20Oscillator.pd f, which I suggest be added to the help. And that was where I got the strategy advice:

The strictest rule would be to sell when the %D line crosses above 80—in other words, when the stock becomes overbought—and buy when it crosses below 20 and becomes oversold. This strategy, however, has flaws. ... A more conservative approach is to allow the oscillator to cross either above 80 or below 20 and wait until it reverses itself—in other words, wait until it crosses back below 80 before selling and wait until it rises above 20 before buying.Both that description and MarketScreen's description (http://www.marketscreen.com/help/atoz/default.asp?hideHF=&Num=99) talk about a 4th variable to specify the type of smoothing to be done (SMA, EMA, WMA, etc.) I have attached the source code for a Stochastics indicator which allows the user to select the type of smoothing that is desired on the %D plot.

Best regards,

KBJ

NinjaTrader_Ray
10-17-2007, 03:40 PM
Awesome, thanks for posting. Would be great if you could post it in the NinjaScript File Sharing section.

KBJ
10-17-2007, 04:44 PM
Done. (See http://www.ninjatrader-support.com/vb/showthread.php?p=17905#post17905) (http://www.ninjatrader-support.com/vb/showthread.php?p=17905#post17905%29).