PDA

View Full Version : Compile error with MIN and MAX variable assignment


lewdfinger
02-10-2007, 05:20 AM
double channelLow = MIN(Low, Bob);

double channelHigh = MAX(High, Bob);

Bob is an integer input for bars back. When I compile I get the message: Cannot implicitly convert type 'NinjaTrader.indicator.MAX' to 'double' and Cannot implicitly convert type 'NinjaTrader.indicator.MIN' to 'double'

Am I doing something wrong?

KD

NinjaTrader_Dierk
02-10-2007, 06:10 AM
Yes. MIN/MAX are indicators. To access value at most current bar try

double channelLow = MIN(Low, Bob)[0];

lewdfinger
02-10-2007, 07:13 AM
Thanks Man! I thought that [0] was implicit, but adding it fixed the problem.