NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript File Sharing > NinjaScript File Sharing Discussion

NinjaScript File Sharing Discussion Discussion for shared NinjaScript files.

Reply
 
Thread Tools Display Modes
Old 10-17-2007, 04:42 PM   #1
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default Stochastics Indicator With Selective Smoothing

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

KBJ

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

05-Nov-2007: Improved the code.
Attached Images
File Type: jpg Capture.JPG (41.7 KB, 160 views)
Attached Files
File Type: zip StochasticsWithSmoothing.zip (26.3 KB, 138 views)
Last edited by KBJ; 11-04-2007 at 10:41 PM.
KBJ is offline  
Reply With Quote
Old 11-04-2007, 10:40 PM   #2
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

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.)
KBJ is offline  
Reply With Quote
Old 11-05-2007, 04:30 PM   #3
randyjb
Member
 
Join Date: Feb 2007
Location: , ,
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
Default Stochastics Indicator with Selective Smoothing..

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
randyjb is offline  
Reply With Quote
Old 11-05-2007, 11:30 PM   #4
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

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
KBJ is offline  
Reply With Quote
Old 11-06-2007, 12:30 PM   #5
randyjb
Member
 
Join Date: Feb 2007
Location: , ,
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
Default

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
randyjb is offline  
Reply With Quote
Old 03-11-2008, 04:35 PM   #6
cls71
Senior Member
 
Join Date: Jan 2008
Location: Madrid, Spain
Posts: 229
Thanks: 2
Thanked 0 times in 0 posts
Default

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)
Attached Images
File Type: png indicator.png (45.1 KB, 80 views)
cls71 is offline  
Reply With Quote
Old 03-11-2008, 04:54 PM   #7
cls71
Senior Member
 
Join Date: Jan 2008
Location: Madrid, Spain
Posts: 229
Thanks: 2
Thanked 0 times in 0 posts
Default

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.
cls71 is offline  
Reply With Quote
Old 03-12-2008, 12:21 AM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

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.
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Stochastics NinjaTrader_Ray NinjaScript File Sharing Discussion 22 11-09-2011 03:34 AM
Stochastics Overlay NinjaTrader_Josh NinjaScript File Sharing Discussion 18 08-14-2009 01:42 PM
Stochastics vs Fast Stochastics Indicator KBJ Miscellaneous Support 4 10-17-2007 04:44 PM
RSI Smoothing rally Charting 2 08-12-2007 01:57 PM
Adapative Stochastics Indicator dgregor5 Indicator Development 3 07-19-2007 11:38 AM


All times are GMT -6. The time now is 01:47 PM.