GustavoPinho:
This forum is about MT5, please post your question about MT4/mql4 on mql4.com forum. Thanks.
Greetings,
I was trying to program an EA that moves 22% of my free margin for every trade it opens. Only one position is open at a time and the only positions opened are those from the EA.
The code I used for finding out the size of the trade was this one:
And the this function gets called right before I open a new poisiton. For example:
The problem is: Most of the times the locked margin is just what i expected (22%). But there are times that the locked margin is almost the double of what I expected. Any ideas of why it happens? My bet is there is something wrong with the timing of the communication with the server, but I don't know what it is.
Oh, sorry. I'll fix that
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Greetings,
I was trying to program an EA that moves 22% of my free margin for every trade it opens. Only one position is open at a time and the only positions opened are those from the EA.
The code I used for finding out the size of the trade was this one:
And the this function gets called right before I open a new poisiton. For example:
The problem is: Most of the times the locked margin is just what i expected (22%). But there are times that the locked margin is almost the double of what I expected. Any ideas of why it happens? My bet is there is something wrong with the timing of the communication with the server, but I don't know what it is.