Hi guys,
I'm using satellite comms, so I can't spend much time searching and browsing, bit expensive.
What I need to do is close blocks of trades, say I have some buys open, say 0.01 lot, 0.05 lot and 0.14 lots = 0.2 lots total. Now I need to close 0.16 lots. So I would have to close a few trades and partially close the last one to meet my goal.
How do I do that? Anybody can point me to an article or even post some code. Would be greatly appreciated.
Logic.
Easy to close a portion of a trade if the close order you send is smaller than the open trade, so send orderclose 0.01 to close and order that's 0.1 for example. But because of FIFA you need to close out the oldest first. So now I want to close 0.1 for example but my oldest trade is only 0.01, so now I go to close the thing, and then go onto the next one and keep going till I've closed what I wanted to close.
I had a few goes at it, but so far I haven't managed to accomplish it. And I'm very sure someone here has. So like to have a look at how it's done.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
I'm using satellite comms, so I can't spend much time searching and browsing, bit expensive.
What I need to do is close blocks of trades, say I have some buys open, say 0.01 lot, 0.05 lot and 0.14 lots = 0.2 lots total. Now I need to close 0.16 lots. So I would have to close a few trades and partially close the last one to meet my goal.
How do I do that? Anybody can point me to an article or even post some code. Would be greatly appreciated.
theMonkey