Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Accessing another indicator from within an indicator?
I have an indicator that I use that plots a 20 period moving average from a 5min chart on a 1 min chart. I like it better than using a "proxy", but I would like to be able to access its value from with in another indicator that I wrote. Not sure what I need to do to be able to access an indicator from with in an indicator? Anyone have some sample code they could share? Not the regular indicators either like a built in Ninja EMA, I got that. Thanks for any advice.
Can you help answer these questions from other members on NexusFi?
If you want to access a first indicator from within a second indicator, this is possible, if the following conditions are met.:
(1) The first indicator must have the values that you want to access exposed in the properties. You cannot access values that are not exposed
(2) Some further restrictions apply for the first indicator. For example the access will not work if the first indicator loads daily bars asynchronously or if it calls ChartControl without checking for null.
(3) The second indicator now can access the first one.
Example
Let us have a look at a simple example. I will take the EMA.
The EMA has only one parameter, which is the period. So you would need to define a variable periodEMA to collect that value from the user.
Put PeriodEMA in the properties section accordingly.
Now that periodEMA exists and contains a value, you can access the indicator by calling it in OnBarUpdate():
Just sitting down for the evening and it is too late to try to code my indicator this evening, but I can tell from your sample that it is pretty straight forward. I'll give it a try tomorrow morning. Thanks MUCH!
I purchased a system online and thankfully it was not a scam . That being said, I was interested in backtesting it using the strategy analyzer. The indicator that sets up the signals comes as a downloadable installer and I can't seem to be able to access it anywhere using the ninjascript editor. This may be the whole exposing attributes publicly issue pointed out previously.
It does however plot signals as it goes, so I was hoping to access the attributes of previous bars (ie. color), or the drawings (see the purple hashes in the attached img). Is this possible? This ninja forum says not, but I'd figure I should ask the good people here for some enlightenment.
You cannot edit a commercial indicator, but you can access the exposed values. To find out which are the exposed values, open the NinjaTrader editor, type the name of the indicator followed by a dot. For example for the SMA, you would type
You should then see the exposed DataSeries that you can access (and a lot of other junk as well). Or you ask the supplier of your commercial indicator, which of the values are exposed.
Don't know if this helps, but it's a little ditty I wrote a long time ago, creating a new indicator in which d9ParticleOscillator is referenced twice (14 period and 34 perod). Simple. It compares the 14 period raw trend to the 34 period raw trend and draws an arrow.