PDA

View Full Version : Stochastics Indicator With Selective Smoothing


KBJ
10-17-2007, 05:42 PM
Some descriptions of the Stochastics indicator 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.

Refer to the following link for more info: Stochastics vs Fast Stochastics Indicator (http://www.ninjatrader-support.com/vb/showthread.php?p=17893)

KBJ

30-Oct-2007: I've modified this post to include a screen shot of the parameters screen.

05-Nov-2007: Improved the code.

KBJ
11-04-2007, 11:40 PM
I have just updated code, below, so the CalcMovingAverage method returns the the Indicator class, which allows more flexible use.

([re]download attachment below for details.)

randyjb
11-05-2007, 05:30 PM
That's pretty slick!.. Any chance you might some day duplicate that same change to the one Josh has posted in the forum called StochasticsOverlay (the one that lays on top of price) ? Although I would guess you probably already have loads of other projects in the que.

Happy Trading

KBJ
11-06-2007, 12:30 AM
Randy,

Thanks. All kudos gratefully accepted.

Unfortunately the Stochastics Overlay indicator is written in such a way that it would not be easy to merge in the code that colors in-between lines.

We'll see what NT V6.5 has to offer, as there's supposed to be a way to do this kind of thing a lot easier.

KBJ

randyjb
11-06-2007, 01:30 PM
Understood KBJ. Thanks for considering it and let's hope there are some new and exciting possibilities with the new 6.5 when it comes out.

Thanks again and Happy Trading,
Randy

cls71
03-11-2008, 05:35 PM
I have loaded over one chart this indicator and it worked perfectly.
However, when I opened and compiled it (whithout any modifications), showed me errors. Error code C0246.

Regards.

(NT version 6.5.0.10)

cls71
03-11-2008, 05:54 PM
I have just seen the problem.
The enum declaration must be between <class definition> and <Ninja Script code generated ... >

Will it be because of the version ?

REgards.

NinjaTrader_Josh
03-12-2008, 01:21 AM
No it is not because of the version of NT. Using enums generally should be declared outside the indicator class which is why you only need to declare it once for all your NinjaScript files. Do it once in any of your NinjaScripts and then you can use the enums in any file.