PDA

View Full Version : MAX/MIN limits


Richard Von
07-30-2007, 07:27 AM
I am trying to use the MAX or MIN functions as part of an if condition to determine if a built-in indicator has attained at least a specified value over the past number of bars. For example,

if MAX(MACD(4,5,3),5) > .05

I get a message that the > operator cannot be used with MAX.

How can I do this?

NinjaTrader_Ray
07-30-2007, 07:38 AM
Hi Richard,

In case you may have not seen this, the following section of our Help Guide might be of some value.

http://www.ninjatrader-support.com/HelpGuideV6/WorkingWithDataSeries.html

You are trying to compare the indicator to a value of 0.05 NOT the value of the indicator at a specific bar. It should be written as:

if (MAX(MACD(4, 5, 3), 5)[0] > 0.05)
// Do something

Not the reference to the value of the indicator at the current bar by using [0].

Richard Von
07-30-2007, 08:17 AM
You are very patient. Thank you for the help.

Little by little some of this is sinking in. I have read the DataSeries reference several times, but when you are starting out it is very confusing. I'll keep working on it.

NinjaTrader_Ray
07-30-2007, 08:29 AM
No problem Richard. What I have personally done in the past when challenged with new concepts is to start off with simple tasks and layer complexity on top of it. This has always helped keep the 'learning' under control.