This is the part of my coding in my EAs that is giving me some headaches.
This will check if there is free margin to open the position, but seems is failing in some brokers that are using Stopoutmode==1.
This is the only part of the coding that I didnt make it, seems that checking free margin was easy and I folloed this code somewhere I dont remember. Normally works ok. But some brokers like FXCM that has a AccountStopOutLevel() of 100 are failing with any positions, because the function will return false everytime.
"int command" is the direction of the trade. 0=OP_BUY, etc...
bool EnoughMargin(int command, double volumen)
Can anyone to help me with this code that check if there is enough margin before opening a position? Im using this code for this EAs, so I need them to be perfect:
- BeLikewater: https://www.mql5.com/en/market/product/8294
- Sunday Decisions: https://www.mql5.com/en/market/product/9521
You compare wrong things.
Just use this.
bool EnoughMargin(double volumen)
Thank you very much. My brain is no longer willing to learn new things lately it seems.
To add comments, please log in or register