Hi ,
I have an issue, I am taking tick volume data and getting percent rates. The problem is that when i take the bullish and bearish tick data(both much above 0) and divide them and after that *100 , i get 0. I printed out everything and i find no logical reason for that. The data is taken with the MQL5 DOM - the processes are managed within the onbookevent handler.
Thats the code.
I hope someone will have a solution!
Thanks
The problem with your code is that you are doing integer math with an implicit cast to double. You need to cast int/long values to double before you divide them. Better yet use a function.
void OnStart() { long x = 1; long y = 2; Print(percentage(x, y)); } template<typename T1, typename T2> double percentage(T1 numerator, T2 denominator) { return double(numerator) / double(denominator) * 100.0; }
The problem with your code is that you are doing integer math with an implicit cast to double. You need to cast int/long values to double before you divide them. Better yet use a function.
thanks a lot , worked !!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi ,
I have an issue, I am taking tick volume data and getting percent rates. The problem is that when i take the bullish and bearish tick data(both much above 0) and divide them and after that *100 , i get 0. I printed out everything and i find no logical reason for that. The data is taken with the MQL5 DOM - the processes are managed within the onbookevent handler.
Thats the code.
I hope someone will have a solution!
Thanks