Does anyone know whether there is a function available in MQL4 that converts negative numbers into positive?
I want to measure the length of a candle's body in pips and to do this, I subtract the open from the close. So for bullish candles where the close is higher, the length is a positive number but for bearish candles where the close is lower than the open, the length is a negative number. So I need my function to work for both instances but to result in a positive number.
I could set up an If/ELSE function to determine whether the close is higher or lower than the open, which would then direct it to the appropriate method of subtraction but I was hoping that there was a function already available just to drop the negative symbol from the result.
Hi all.
Does anyone know whether there is a function available in MQL4 that converts negative numbers into positive?
I want to measure the length of a candle's body in pips and to do this, I subtract the open from the close. So for bullish candles where the close is higher, the length is a positive number but for bearish candles where the close is lower than the open, the length is a negative number. So I need my function to work for both instances but to result in a positive number.
I could set up an If/ELSE function to determine whether the close is higher or lower than the open, which would then direct it to the appropriate method of subtraction but I was hoping that there was a function already available just to drop the negative symbol from the result.
Mark