I have been testing my ea with an automatic lot sizing code without problems on mt5. I removed mt5 from my pc and reinstalled it, since then i have been getting errors saying that the account funds are insufficient when the ea tries to place trades. My calculations dont use OrderCalclMargin, i have code for that. My code uses AccountInfoInteger(ACCOUNT_LEVERAGE). When i change the leverage in strategy tester my code recognizes this and adjusts as it should. All the below looks good to me but mt5 strategy tester seems to disagree in the last line. Can anyone tell me where mt5 is getting that margin calculation from in the last line in the below log? if ACCOUNT_LEVERAGE is not the relevant leverage multiplier then what is? I know that there are other leverage multipliers but none of the symbol leverage properties match up with the results in the last line below.
2021.09.17 23:28:54.3862018.01.01 00:00:43 Account to Quote pair GBPUSD
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi
I have been testing my ea with an automatic lot sizing code without problems on mt5. I removed mt5 from my pc and reinstalled it, since then i have been getting errors saying that the account funds are insufficient when the ea tries to place trades. My calculations dont use OrderCalclMargin, i have code for that. My code uses AccountInfoInteger(ACCOUNT_LEVERAGE). When i change the leverage in strategy tester my code recognizes this and adjusts as it should. All the below looks good to me but mt5 strategy tester seems to disagree in the last line. Can anyone tell me where mt5 is getting that margin calculation from in the last line in the below log? if ACCOUNT_LEVERAGE is not the relevant leverage multiplier then what is? I know that there are other leverage multipliers but none of the symbol leverage properties match up with the results in the last line below.
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Account to Quote pair GBPUSD
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Above exchange rate 1.35114
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Account Balance 1000.0
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Free Margin 1000.0
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Current Leverage 33
2021.09.17 23:28:54.386 2018.01.01 00:00:43 total Units Traded 8000.0
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Required Margin 201.8
2021.09.17 23:28:54.386 2018.01.01 00:00:43 decimalPipValue=0.0001
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Contract Size=100000.0
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Price Of Pip=7.401157541039418
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Risk In Account Currency=20.0
2021.09.17 23:28:54.386 2018.01.01 00:00:43 Calculated Lot Size=0.08
2021.09.17 23:28:54.781 2018.01.01 00:00:43 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 1000.00, Margin: 2874.37, FreeMargin: -1874.37