STEP12 How to get the lowest candle

The lowest candle can be useful for technical Expert Advisors

If you have ever read a book about technical chart analysis, you might know that it is all about new highs and new lows. To calculate the lowest candle within the last x candles, you can use this simple code (simply paste into new and empty EA template)

double LowestCandleM1;
void OnTick()
LowestCandleM1= CheckForLowestCandle();
Comment ("Number of the lowest candle within the last 10 candles before the current candle: "+ LowestCandleM1);
double CheckForLowestCandle()
double Low[];
double Calc1= ArrayMinimum(Low,0,11);
return Calc1;

Here is how it looks like


If you want to use it within you own EA, simply copy and paste the CheckForLowestCandle() function and add the two lines in the OnTick function into the appropriate place in your own code.

Would you like to know the lowest candle within the last 100 candles instead? Simply change the number 11 in the two lines above the line

return Calc1;

to 101.