EA31337 / EA31337-classes

📦📈 EA31337 framework (MQL library for writing trading Expert Advisors, indicators and scripts)
https://ea31337.github.io/EA31337-classes
GNU General Public License v3.0
186 stars 98 forks source link

Write Account class which implements Account Information functions. #1

Closed kenorb closed 8 years ago

kenorb commented 8 years ago

Convert existing code (Account.mqh) into class which implements all listed Account Information methods using the same name as in MT4 documentation (some of them are already there). These methods should work for both MQL4 (MT4) and MQL5 (MT5) platforms (see the MT5 docs). Remove anything else which is not related to Account methods.

Language: MQL 4&5

To compile for each version, you need to install both platforms (MT4 & MT5) and compile using MetaEditor.

LemonBoy commented 8 years ago

This [1] one's missing some methods which, from my limited understanding, require something more than a simple stub to be replaced (namely AccountFreeMarginMode and AccountFreeMarginCheck), while AccountStopoutLevel is now a double and that might cause some problems.

[1] https://ptpb.pw/Zv90

kenorb commented 8 years ago

The code is fine.

The AccountStopoutLevel depending on AccountStopoutMode, so if you've different mode on two different platform, the output can vary. Same for AccountFreeMarginCheck, it probably rely on AccountFreeMarginMode. This porting table may help, or check. If not, add the @fixme and you may move on, so this could be fixed later on, on some concrete use case when testing some specific code as part of another task.

I think I understand what you're saying. Based on the porting table (if that's correct), the AccountStopoutLevel is the same as AccountInfoDouble(ACCOUNT_MARGIN_SO_SO), where it seems AccountInfoDouble exist in both MQL4 and MQL5, so potentially both code versions (4&5) can use:

AccountInfoDouble(ACCOUNT_MARGIN_SO_SO)

instead of: AccountFreeMarginCheck, then that's fine. In case the format is vary between version, I think choose MQL5 then as moving forward and add some note, but it's probably depending on the use case. I hope that answer the question.