Schumacher Drive:
Hi guys,
I need a help regarding the lot multiplier.
I've made a multiplier that follow step balance - so it increases first lot accordingly to the balance of the account.
However I have a problem setting up the multiplier.
So far I've found the ROUND UP option but it's not good, for example when you have a multiplier where you get 0.011 it will round up to the highest 0.02 instead of keeping it at 0.01 as i wanted.
Can someone assist me about this, how can i just ROUND the number in two decimals?
Thanks in advance!
Hi guys,
I need a help regarding the lot multiplier.
I've made a multiplier that follow step balance - so it increases first lot accordingly to the balance of the account.
However I have a problem setting up the multiplier.
So far I've found the ROUND UP option but it's not good, for example when you have a multiplier where you get 0.011 it will round up to the highest 0.02 instead of keeping it at 0.01 as i wanted.
Can someone assist me about this, how can i just ROUND the number in two decimals?
Thanks in advance!
Please use
MathCeil()
rather than
MathRound()
Schumacher Drive: I need a help regarding the lot multiplier. I've made a multiplier that follow step balance - so it increases first lot accordingly to the balance of the account. However I have a problem setting up the multiplier.
So far I've found the ROUND UP option but it's not good, for example when you have a multiplier where you get 0.011 it will round up to the highest 0.02 instead of keeping it at 0.01 as i wanted. Can someone assist me about this, how can i just ROUND the number in two decimals?
So far I've found the ROUND UP option but it's not good, for example when you have a multiplier where you get 0.011 it will round up to the highest 0.02 instead of keeping it at 0.01 as i wanted. Can someone assist me about this, how can i just ROUND the number in two decimals?
Please take the time to search and read the documentation before posting ...
Returns integer numeric value closest from above
Returns integer numeric value closest from below
Rounds of a value to the nearest integer
Here is an example using MathFloor, but in your case you should use MathRound instead ...
Forum on trading, automated trading systems and testing trading strategies
Fernando Carreiro, 2023.12.16 19:12
void OnStart() { double dbSeed = 1.0, dbRatio = 1.5, dbStep = 0.01; for( int i = 0; i < 10; i++ ) { PrintFormat( "Lots: %.2f (Value: %.6f)", MathFloor( dbSeed ) * dbStep, dbSeed ); dbSeed *= dbRatio; }; };Lots: 0.01 (Value: 1.000000) Lots: 0.01 (Value: 1.500000) Lots: 0.02 (Value: 2.250000) Lots: 0.03 (Value: 3.375000) Lots: 0.05 (Value: 5.062500) Lots: 0.07 (Value: 7.593750) Lots: 0.11 (Value: 11.390625) Lots: 0.17 (Value: 17.085938) Lots: 0.25 (Value: 25.628906) Lots: 0.38 (Value: 38.443359)
Documentation on MQL5: Math Functions / MathRound
- www.mql5.com
MathRound - Math Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
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
I need a help regarding the lot multiplier.
I've made a multiplier that follow step balance - so it increases first lot accordingly to the balance of the account.
However I have a problem setting up the multiplier.
So far I've found the ROUND UP option but it's not good, for example when you have a multiplier where you get 0.011 it will round up to the highest 0.02 instead of keeping it at 0.01 as i wanted.
Can someone assist me about this, how can i just ROUND the number in two decimals?
Thanks in advance!