Change of base
The logarithm log bx can be computed from the logarithms of x and b with respect to an arbitrary base k using the following formula: logb x = logk x ÷ logk b.
Therefor
double MathLog2(double x){ return MathLog(x) / MathLog(2.0); }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How do I get log with base 2.
There are two options in mt4:
1. MathLog - which return natural log for a number
2. MathLog10 - which return log with base 10 for a value.
In my program, I need to get log with base 2. How do I do that? What line of code should i write?