NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 11-04-2008, 11:07 AM   #1
designer
Senior Member
 
Join Date: Sep 2008
Posts: 289
Thanks: 0
Thanked 0 times in 0 posts
Default Creating Stochastics of CCI

I am trying to create an indicator of an indicato and cant figure it out I followed the example of the SMA of Volume but would like help on the Wizzard.
Thanks
designer is offline  
Reply With Quote
Old 11-04-2008, 12:16 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Hi designer,

Thanks for the post. Please tell us at what step you run into trouble following the tutorial and we will gladly assist you. Here is the tutorial link - http://www.ninjatrader-support.com/H...verview22.html
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-04-2008, 10:20 PM   #3
designer
Senior Member
 
Join Date: Sep 2008
Posts: 289
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Josh,
I am trying to create an indicator which is the Stochastics of the CCI. I was able to create all the parameters from the wizzard but when I get to the code portion i'm not sure where to insert the code from the CCI and the Stochastics. I guess I have to insert the CCI code...
Thanks
designer is offline  
Reply With Quote
Old 11-05-2008, 09:17 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Hi designer,
First you will have to create a DataSeries object, because the Stochastics takes only a DataSeries input. In the Variables section add

Code:
 private new DataSeries cciValue;
Then in the Initialize add

Code:
 cciValue = new DataSeries(this);
Then you can use the Set() method to fill the DataSeries in the OnBarUpdate section

Code:
 cciValue.Set(CCI(Close, MyPeriod)[0]);
Finally you can create your Stochastic CCI calculation

Code:
 double stochCCI = Stochastics(cciValue, MyPeriodD, MyPeriodK, MySmoothingPeriod)[0];
Please also review this link -
http://www.ninjatrader-support.com/H...iesObject.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-06-2008, 06:20 AM   #5
designer
Senior Member
 
Join Date: Sep 2008
Posts: 289
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks,
Do you suggest a similar indicator I can use as a template for the NT code?
designer is offline  
Reply With Quote
Old 11-06-2008, 08:12 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Hi designer,

Please check out the following thread, the indicator posted there should give a good starting point for what you want to do -

http://www.ninjatrader-support2.com/...ead.php?t=3952


Quote:
Originally Posted by designer View Post
Thanks,
Do you suggest a similar indicator I can use as a template for the NT code?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-06-2008, 07:58 PM   #7
designer
Senior Member
 
Join Date: Sep 2008
Posts: 289
Thanks: 0
Thanked 0 times in 0 posts
Default

Would I be able to use the StochRSI code (attached)and just replace RSI with CCI in the code?
Thanks
Attached Files
File Type: cs @StochRSI.cs (9.9 KB, 13 views)
designer is offline  
Reply With Quote
Old 11-06-2008, 10:33 PM   #8
Elliott Wave
Senior Member
 
Join Date: Mar 2008
Posts: 731
Thanks: 0
Thanked 1 time in 1 post
Default

I don't see why not. It should work fine. I have replaced RSI with CCI in indicators before and it was very simple and effective.
Elliott Wave is offline  
Reply With Quote
Old 11-07-2008, 09:44 AM   #9
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Hi,

Yes, this indicator can easily be modified to produce a Stochastic CCI.

Your minimum, maximum and rsi sets would then look like this -

Code:
minimum.Set( MIN(CCI(PeriodRsi), LookBack)[0]);
maximum.Set( MAX(CCI(PeriodRsi), LookBack)[0]);
rsi.Set( CCI(PeriodRsi)[0]);
Of course for better style you would want to change the PeriodRSI variable name into PeriodCCI (in the Variables and Properties sections), same with the rsi.Set dataseries.


Quote:
Originally Posted by Elliott Wave View Post
I don't see why not. It should work fine. I have replaced RSI with CCI in indicators before and it was very simple and effective.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-08-2008, 08:32 AM   #10
designer
Senior Member
 
Join Date: Sep 2008
Posts: 289
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks,
I was able to paste your CCI code as shown below (see attachment) then i saved it but when I try to import the saved file into the chart i do not see it in the Indicators list...please check if i placed in the right location.
Thanks
Attached Files
File Type: cs FCCIStochastics.cs (10.4 KB, 9 views)
designer is offline  
Reply With Quote
Old 11-08-2008, 09:01 AM   #11
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Save this file in

My Documents\NinjaTrader 6.5\bin\Custom\Indicator

Then in NT select, Tools > Edit NinjaScript > Indicator and select this indicator.
Then compile it by pressing the F5 key in the Editor.
Now this indicator will be available in NT.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-08-2008, 09:18 AM   #12
designer
Senior Member
 
Join Date: Sep 2008
Posts: 289
Thanks: 0
Thanked 0 times in 0 posts
Default

Ray thanks I did as sugested but get the following errors in lines 50-56
Error CS0103

Thanks
designer is offline  
Reply With Quote
Old 11-08-2008, 09:23 AM   #13
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

You would then have to debug the error, I would not know what the problem is since its not my code.

Here is a help resource that may provide some guidance - http://www.ninjatrader-support2.com/...ead.php?t=3418
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-10-2008, 10:39 AM   #14
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Hi designer,

Please check out this debugged and commented code of the StocCCI and let me know if you have questions.


Quote:
Originally Posted by designer View Post
Ray thanks I did as sugested but get the following errors in lines 50-56
Error CS0103

Thanks
Attached Files
File Type: zip StocCCI.zip (8.7 KB, 46 views)
NinjaTrader_Bertrand 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
Stochastics Overlay NinjaTrader_Josh NinjaScript File Sharing Discussion 18 08-14-2009 01:42 PM
CCI Stochastics designer Indicator Development 1 09-21-2008 02:24 PM
version 6 vs 6.5 stochastics different rc5781 Charting 1 04-07-2008 07:54 PM
Applying Stochastics to SMA jeremymgp Indicator Development 1 12-03-2007 11:37 PM
Stochastics vs Fast Stochastics Indicator KBJ Miscellaneous Support 4 10-17-2007 04:44 PM


All times are GMT -6. The time now is 07:09 AM.