PDA

View Full Version : 2 of the same


ts888
07-10-2007, 09:39 AM
very new to NinjaScript and just playing around. If I wanted to write or modify and indicator or strategy and wanted to have 2 of the same indicator (different parameters) referenced. How would I distinguish the two?

for example.....let's say I'm writing an indicator that does action X when the MACD does action Y. What if on the same chart I had a longer term MACD and wanted to use it in the indicator? How would I distinguish between MACD(1) and MACD(2) ?

thanks

NinjaTrader_Ray
07-10-2007, 09:42 AM
What do you mean by distinguish? Programmatically or visually?

ts888
07-10-2007, 09:45 AM
What do you mean by distinguish? Programmatically or visually?

I suppose I mean progammatically because I can visually see them on my chart. I have the MACD in 1 panel and then a longer term MACD below that in a different panel. I just don't know what to call them in the script so that it knows which MACD I'm referencing.

NinjaTrader_Ray
07-10-2007, 09:51 AM
You just pass in different parameters. For example:

Print(MACD(20, 3, 3)[0]);
Print(MACD(40, 3, 3)[0]);

Prints out the current bar value for two different MACD's.

ts888
07-10-2007, 09:53 AM
You just pass in different parameters. For example:

Print(MACD(20, 3, 3)[0]);
Print(MACD(40, 3, 3)[0]);

Prints out the current bar value for two different MACD's.


great. Thx Ray.