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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-03-2011, 04:56 AM   #1
Stopped
Senior Member
 
Join Date: Jun 2010
Location: London, U.K.
Posts: 174
Thanks: 29
Thanked 1 time in 1 post
Default Getting values from loaded indicator?

Hello,

I was wondering if it is technically possible to get values from an indicator currently loaded on a chart to pass them on onto another indicator loaded on the same chart.

My programming skills are pretty basic, but I have normally managed to complete any tasks required to achieve a goal, although probably not in the most efficient way.

At the moment what I do is to code indicators within another indicator, which means that the list of parameters I used in the indicator containing other indicators gets longer and longer, and when I change the parameters in the first indicator (used as input in the second one) then I have to also change the parameters in the second indicator, a process which gets tedious and subject to human error.

I have been reading a bit about User Defined Methods, and was wondering if a solution to this problem could be found there.

Please advice if that is the route I should explore (any other hints welcome!)

Thanks,

Stopped
Stopped is offline  
Reply With Quote
Old 07-03-2011, 05:30 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,413
Thanks: 252
Thanked 976 times in 959 posts
Default

Hi Stopped, sorry not following what you would like to do - if you need indicator values from another indicator you can just call the indicator method in the script, there would be no need / way to directly access an explicit indicator loaded on a chart.

Have a good Sunday,
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 07-03-2011, 06:24 AM   #3
Stopped
Senior Member
 
Join Date: Jun 2010
Location: London, U.K.
Posts: 174
Thanks: 29
Thanked 1 time in 1 post
Default

Hi Bertrand,

Thanks for your quick reply on a weekend!

I did not explain myself correctly. Let's try again using a very simple example:
  1. Let's say I load the SMA (Period) indicator onto a chart, with Period set to 20.
  2. Now suppose I load a second indicator, MAX(SMA(SMA Period), Lookback), and that I would like the SMA Period parameter (customisable) to match the Period parameter of the first indicator. For completeness, let's assume I set Lookback to 10, so we have MAX(SMA(20), 10).
  3. For whatever reason I decide I would like to change the input on the first indicator to 10 from 20, so it becomes SMA (10).
  4. Now, however, the second indicator uses a parameter that no longer matches the one on the first indicator. So I click on the Indicators button to change the SMA Period parameter on the second indicator to 10.
This is all OK I guess, but I was wondering if there is a way to code the second indicator in a way that whenever I decide to change the Period parameter in the first indicator this would feed into the second indicator by automatically adjusting the SMA Period parameter as well.

Thanks in advance,

Stopped
Stopped is offline  
Reply With Quote
Old 07-03-2011, 06:42 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,413
Thanks: 252
Thanked 976 times in 959 posts
Default

Thanks for the clarification, this would only work if you coded one complete indicator doing the different plots based on your custom criteria, you could then define user defined inputs for the indicator that could be used in various method calls in the code so all would as just per your inputs as desired.

http://www.ninjatrader.com/support/f...ead.php?t=5782
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Old 07-03-2011, 08:35 AM   #5
Stopped
Senior Member
 
Join Date: Jun 2010
Location: London, U.K.
Posts: 174
Thanks: 29
Thanked 1 time in 1 post
Default

Hi Bertrand,

Thanks for that suggestion.

Can I use a combined indicator to plot graphs in separate panels? Or would I need to create more than one indicator in that case?

Cheers,

Stopped
Stopped is offline  
Reply With Quote
Old 07-03-2011, 08:42 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,413
Thanks: 252
Thanked 976 times in 959 posts
Default

You're welcome - you would need an indicator per panel then, as you could not draw to specific panels via the code.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
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
prevent indicator to be saved/loaded in chart template DH008 Indicator Development 1 02-18-2011 10:36 AM
Indicator: Getting indicator values from a specified time NinjaTrader_Josh Reference Samples 0 07-29-2009 10:46 AM
executing code after indicator has been loaded? NinjaCustomer Indicator Development 1 02-05-2009 09:59 PM
Using indicator values traderT Strategy Development 12 01-09-2009 02:15 PM
Indicator: Exposing indicator values that are not plots NinjaTrader_Josh Reference Samples 0 01-15-2008 02:27 AM


All times are GMT -6. The time now is 05:48 AM.