Body/Candle ratio
If the high is equal to the low, then double candle_height = (high-low) equals zero.
Then, double ratio = (body_height/candle_height) causes a divide by zero error
Dividing by zero is not permitted, and the code exits with "divide by zero" error..
I'm trying to include the body_height/candle_height ratio to my entry conditions and MT is complaining about "zero-divide".
This is how i try ty calculate it:
double low = iLow(NULL, 0, 1);
double high = iHigh(NULL, 0, 1);
double close = iClose(NULL, 0, 1);
double open = iOpen(NULL, 0, 1);
double candle_height = (high-low);
double body_height = MathAbs(open-close);
double ratio = (body_height/candle_height);
Any ideas what I'm doing wrong here?
Thanks a lot!