2022.03.16 10:15:03.324 2.17.390-eu-m15-m.mql (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:15 Computing Money Management for order - Risk fixed % of account
2022.03.16 10:15:03.324 2.17.390-eu-m15-m.mql (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:15 Computing Money Management - Smallest_Lot: 0.01000000, Largest_Lot: 100.00000000, Computed LotSize: 0.00000000
2022.03.16 10:15:03.324 2.17.390-eu-m15-m.mql (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:15 Max money to risk: 0.00000000, SL:1.09314000, Max 1 lot trade drawdown: 0.02000000, Point value: 2.48434860
2022.03.16 10:15:03.324 2.17.390-eu-m15-m.mql (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:15 Calculated LotSize is <= 0. Using LotsIfNoMM value: 0.01000000)
//Maximum amount of money to risk double moneyToRisk = NormalizeDouble(AccountInfoDouble(ACCOUNT_EQUITY) * RiskInPercent / 100, 2); //Maximum drawdown of this order if we buy 1 lot double oneLotSLDrawdown = NormalizeDouble(PointValue * MathAbs(openPrice - sl), 2);
Needs to be this
(or needs to autodetect account type and normalize with way more decimals for crypto)
//Maximum amount of money to risk
double moneyToRisk = AccountInfoDouble(ACCOUNT_EQUITY) * RiskInPercent / 100;
//Maximum drawdown of this order if we buy 1 lot
double oneLotSLDrawdown = PointValue * MathAbs(openPrice - sl);
And now I get this which shows my code is working properly now:
2022.03.16 10:45:03.226 12.17.335-eu-m15-m (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:45 Computing Money Management for order - Risk fixed % of account
2022.03.16 10:45:03.226 12.17.335-eu-m15-m (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:45 Computing Money Management - Smallest_Lot: 0.01000000, Largest_Lot: 100.00000000, Computed LotSize: 0.07000000
2022.03.16 10:45:03.226 12.17.335-eu-m15-m (EURUSD,M15) ---VERBOSE--- 2022.03.16 20:45 Max money to risk: 0.00216605, SL:1.08762000, Max 1 lot trade drawdown: 0.02847054, Point value: 2.46925774
Status changed from New to Fixed
the rounding is there to minimize floating point imprecision issues.
Sometimes there is a slightly different value representation in SQ and MT and it can causes calculated size differences.
I have modified the templates to round to 7 digits, that should be enough hopefully.
Best regards,
Tomas