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 06-24-2011, 05:34 AM   #1
currencychick
Junior Member
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
Default Creating an indicator that will post on different chart type

Is it possible to create an indicator that reads information on a 3 minute chart (looking for simple moving average cross up or down to show trend direction) and have this register on a Range chart. I want this to be a background color change when it occurs.

Thanks
currencychick is offline  
Reply With Quote
Old 06-24-2011, 05:50 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Welcome to our forums - yes that would be possible with our MultiSeries framework in NinjaScript for indicators and strategies :

http://www.ninjatrader.com/support/h...nstruments.htm
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-26-2011, 11:14 AM   #3
ij001
Senior Member
 
Join Date: Apr 2010
Posts: 125
Thanks: 18
Thanked 3 times in 3 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Welcome to our forums - yes that would be possible with our MultiSeries framework in NinjaScript for indicators and strategies :

http://www.ninjatrader.com/support/h...nstruments.htm
Is there any examples off hand that we can take a look at?
ij001 is offline  
Reply With Quote
Old 06-26-2011, 03:08 PM   #4
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
Default

ij001, there are quite a few examples and some very helpful information in the link Bertrand posted. There are also multi-timeframe and multi-instrument strategy samples built into NinjaTrader. You can view these by going to Tools -> Edit NinjaScript -> Strategies -> SampleMulti...

I had a script very similar to the one requested in the first post, so I modified it a bit as a quick demonstration. It just reads data from the secondary data series (BarsInProgress index = 1) and plots it on the main data series.
Attached Images
File Type: png mabarcolors.PNG (51.5 KB, 33 views)
Attached Files
File Type: zip MABarColor.zip (3.8 KB, 13 views)
NinjaTrader_Austin is offline  
Reply With Quote
Old 07-08-2011, 10:13 AM   #5
richbois
Member
 
Join Date: Jan 2009
Posts: 67
Thanks: 7
Thanked 2 times in 2 posts
Default

Quote:
Originally Posted by NinjaTrader_Austin View Post
ij001, there are quite a few examples and some very helpful information in the link Bertrand posted. There are also multi-timeframe and multi-instrument strategy samples built into NinjaTrader. You can view these by going to Tools -> Edit NinjaScript -> Strategies -> SampleMulti...

I had a script very similar to the one requested in the first post, so I modified it a bit as a quick demonstration. It just reads data from the secondary data series (BarsInProgress index = 1) and plots it on the main data series.
If i understand it corectly if you have any indicator and you add this line of code

Add(PeriodType.Minute, 3);

then it will do the calculations based on 3 minutes, and then should it be applied to any other charts it should reflect the calculations of the 3 min even on a 5min 15 min Range Tick Volume charts

Is that correct because i seem to be having issues on some other script

maybe i missed some other line of code

Thank you
richbois is offline  
Reply With Quote
Old 07-08-2011, 10:32 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Hi richbois, that's not entirely correct - you simply add a series for access with this code snippet. I would then call the OnBarUpdate() method for each series added and each bar / tick - so if you do this unfiltered via any BarsInProgress logic it would create erratic results for you:

http://www.ninjatrader.com/support/h...inprogress.htm

This lets you split the OnBarUpdate() call for each series, so you could for example do nothing for the second series by returning out if the OnBarUpdate(0) is called for it, thus you would though still have access to it's series data.

if (BarsInProgress != 0) return; // for any other series but the primary exit OnBarUpdate().
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Old 07-08-2011, 11:02 AM   #7
richbois
Member
 
Join Date: Jan 2009
Posts: 67
Thanks: 7
Thanked 2 times in 2 posts
Default

Thank you Bertrand that solved the problem second line was missing

One last question can a Session Template be used in the calculation of the 3min charts then the results used on a 24/7 R or T chart

Thanks again
richbois is offline  
Reply With Quote
Old 07-08-2011, 11:45 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Great, you're welcome - so cash hour based indicator values but running of a electronic hours chart? That would need more advanced custom coding unfortunately.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Old 07-08-2011, 11:49 AM   #9
richbois
Member
 
Join Date: Jan 2009
Posts: 67
Thanks: 7
Thanked 2 times in 2 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Great, you're welcome - so cash hour based indicator values but running of a electronic hours chart? That would need more advanced custom coding unfortunately.
Thank you and have a great weekend
richbois is offline  
Reply With Quote
Old 07-08-2011, 12:00 PM   #10
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Thanks, enjoy yours as well!
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 07-14-2011, 07:17 PM   #11
lawyse
Certified NinjaScript Consultant
 
lawyse's Avatar
 
Join Date: Aug 2008
Location: Atlanta, GA
Posts: 84
Thanks: 0
Thanked 3 times in 3 posts
Send a message via Skype™ to lawyse
Default Programming

I'm a programmer and I'd be interested in giving you a quote on this project. I've been wanting to do something similar over the last few days. Let me know!
lawyse 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
Want to read S/R lines and post on chart saroj Indicator Development 2 05-05-2009 11:45 AM
Creating an indicator from different tick chart data kevinh786 Indicator Development 1 01-16-2009 09:14 AM
auto set chart type and interval by indicator Creamers Indicator Development 1 08-02-2008 11:53 AM
How to post a New Indicator LG NinjaScript File Sharing Discussion 2 04-18-2008 04:21 PM
Indicator: Creating a user-defined parameter type (enum) NinjaTrader_Josh Reference Samples 0 09-24-2007 09:12 PM


All times are GMT -6. The time now is 07:38 PM.