AccountInfoDouble(ACCOUNT_EQUITY) returns 0.0.
This occurs maybe 50% of the time. The rest of the time it returns 10000, which is the value I set in the tester.
The same EA functions as I would expect on build 1643. That is, I cannot get AccountInfoDouble(ACCOUNT_EQUITY) to return 0.0 no matter how many times I run the tester.
I uninstalled MT5, then reinstalled—same issue.
I then installed build 1502, which I found lying around in the forum. Much like build 1643, it works as expected. I am fairly certain this is new to 1730.
The issue happens pretty quickly. I added some code to OnInit():
double equity = AccountInfoDouble(ACCOUNT_EQUITY);
Print(StringFormat("ACCOUNT_EQUITY [%G]", equity));
if ( equity <= 0.0 )
Print("ACCOUNT_EQUITY is $0");
As I said, it dies maybe half of the time.
Can anyone tell me how this value is determined internally?
Attaching two log files.
OK.log is under normal operation, what I would expect to happen.
FAILED.log occurs when the issue described above happens.
Both log files are, as far as I can see, exactly the same until the issue occurs. In fact, line 11 of both files shows that the Tester initial deposit is the same in both cases, $10,000; however, line 114 shows that ACCOUNT_EQUITY is $0 in the failed case.
Additional note: when the failure occurs, the values of Balance, Equity, and Free Margin for the tester are $0. (see attached image) This shows immediately when the "Strategy Tester Visualization" window opens.
I would suggest you to try without tester.tpl
Anyway that seems a bug and you should report it to Metaquotes ServiceDesk.
Tried it w/ new Tester.tpl, and without any Tester.tpl. Issue still occurred.
I will contact the service desk.