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 Development Support > Indicator Development

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

Reply
 
Thread Tools Display Modes
Old 08-16-2012, 12:52 PM   #1
stafe
Junior Member
 
Join Date: Nov 2011
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default pickup variable from another indicator on same chart

i'd like to pick up the Period variable from the @CCI indicator on my chart and use it "automatically" as the period for an indicator i'm developing. not so fluent in programming and i feel like i'm wasting a bunch of time....
is this possible?
thanks,
w
stafe is offline  
Reply With Quote
Old 08-16-2012, 12:56 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello stafe,
Yes, you can do it. Please refer to this sample code which demonstrates it further.
http://ninjatrader.com/support/forum...ead.php?t=5782

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Joydeep for this post:
Old 08-16-2012, 01:09 PM   #3
stafe
Junior Member
 
Join Date: Nov 2011
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default

thanks for the link...
that's a good example of how to setup a variable within an indicator
(as is the case with the @CCI indicator code)

my interest is in having an additional indicator pickup the int variable of Period that is used to plot the CCI below the price chart (pricepanel) and use that same Period int in an indicator that plots signals on the price chart (price panel) -- without having to manually enter a matching int for the period on the 2nd indicator that is plotting on the price panel.
/w
stafe is offline  
Reply With Quote
Old 08-17-2012, 04:04 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello stafe,
Are you trying to expose values which are not plots? If so please refer to this sample code which further demonstrates it
http://ninjatrader.com/support/forum...ead.php?t=4991
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-17-2012, 08:36 PM   #5
overflowing
Member
 
Join Date: Jul 2011
Posts: 37
Thanks: 11
Thanked 6 times in 3 posts
Default

I'm also interested in the same functionality as stafe is describing. I believe what stafe is asking for is, for example, suppose you have an SMA indictator on a chart with 30 as the Period. If I add a custom indicator to this same chart, how can that custom indicator get the period that is being used on the SMA indicator (i.e., 30 in this example)?

This way the custom indicator can use the 30 period for it's own purposes rather than the user having to manually specify a 30 period for the SMA indicator AND manually specify a 30 period for the custom indicator as well. Furthermore, if the user changes the period on the SMA indicator to 50, then the custom indicator should begin using 50 for it's own period value.
Last edited by overflowing; 08-17-2012 at 08:40 PM.
overflowing is offline  
Reply With Quote
Old 08-19-2012, 05:37 PM   #6
stafe
Junior Member
 
Join Date: Nov 2011
Posts: 20
Thanks: 0
Thanked 1 time in 1 post
Default

overflowing, you've got it on the money...
sometimes i have trouble making myself clear, thanks

i'd like to link a custom indicator's Period variable value to the Period variable value on a, let's call it, period source indicator on the same chart - so that - when the "period source" indicator period is changed so too are the other indicators that are linked to the "period source" indicator's period...

@CCI(14) - period source indicator on a 5min chart of /6E
CUSTOM1 - period is linked to that of @CCI which is currently 14
CUSTOM2 - period is linked to that of @CCI which is currently 14
CUSTOM3 - period is linked to that of @CCI which is currently 14
CUSTOM4 - period is linked to that of @CCI which is currently 14
CUSTOM5 - period is linked to that of @CCI which is currently 14
CUSTOM6 - period is linked to that of @CCI which is currently 14
CUSTOM7 - period is linked to that of @CCI which is currently 14
CUSTOM8 - period is linked to that of @CCI which is currently 14
CUSTOM9 - period is linked to that of @CCI which is currently 14

change @CCI(14) to @CCI(12) period changed to 12 on period source indicator
and
CUSTOM1, CUSTOM2, CUSTOM3,CUSTOM4, CUSTOM5, CUSTOM6,CUSTOM7, CUSTOM8, and CUSTOM9
all change to a period of 12 because they are linked to @CCI as a Period value source...

is there a way?
¿there must be a way to link a custom indicator's Period variable int Value to another indicator on the same chart...?

the Period variable Value is an "exposed" Public variable already...
so that's not an issue...6=.5x12

please excuse my programming ignorance
COBAL was the last language i knew anything about.... LOL
stafe is offline  
Reply With Quote
Old 08-19-2012, 05:55 PM   #7
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,187
Thanks: 178
Thanked 301 times in 259 posts
Default

This is what dukeb is doing, getting the period of chart/data series. He's extracted out 30 and minutes and the name.

You could hide your indicators setup values, and use this to automatically set it.

http://www.ninjatrader.com/support/f...ad.php?t=51903



Quote:
Originally Posted by stafe View Post
overflowing, you've got it on the money...
sometimes i have trouble making myself clear, thanks

i'd like to link a custom indicator's Period variable value to the Period variable value on a, let's call it, period source indicator on the same chart - so that - when the "period source" indicator period is changed so too are the other indicators that are linked to the "period source" indicator's period...

@CCI(14) - period source indicator on a 5min chart of /6E
CUSTOM1 - period is linked to that of @CCI which is currently 14
CUSTOM2 - period is linked to that of @CCI which is currently 14
CUSTOM3 - period is linked to that of @CCI which is currently 14
CUSTOM4 - period is linked to that of @CCI which is currently 14
CUSTOM5 - period is linked to that of @CCI which is currently 14
CUSTOM6 - period is linked to that of @CCI which is currently 14
CUSTOM7 - period is linked to that of @CCI which is currently 14
CUSTOM8 - period is linked to that of @CCI which is currently 14
CUSTOM9 - period is linked to that of @CCI which is currently 14

change @CCI(14) to @CCI(12) period changed to 12 on period source indicator
and
CUSTOM1, CUSTOM2, CUSTOM3,CUSTOM4, CUSTOM5, CUSTOM6,CUSTOM7, CUSTOM8, and CUSTOM9
all change to a period of 12 because they are linked to @CCI as a Period value source...

is there a way?
¿there must be a way to link a custom indicator's Period variable int Value to another indicator on the same chart...?

the Period variable Value is an "exposed" Public variable already...
so that's not an issue...6=.5x12

please excuse my programming ignorance
COBAL was the last language i knew anything about.... LOL
sledge 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
Indicator is a type but it is used as a variable. zoki.rb General Programming 7 05-26-2011 07:28 AM
Passing variable from 1 indicator to another. 8DTK8 Indicator Development 7 08-26-2010 03:25 PM
Accessing variable from a 5min Indicator and 15min Indicator mefTrader Market Analyzer 8 01-12-2010 09:14 AM
strat unable to pickup ind value ATI user Version 7 Beta General Questions & Bug Reports 2 12-30-2009 11:31 AM
indicator as variable e-man Version 7 Beta General Questions & Bug Reports 3 10-20-2009 03:38 PM


All times are GMT -6. The time now is 08:46 PM.