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
Hi, first time asking here, thanks in advance.
As the title implies I am looking for a script/function to account trade deals as "net lots" or "net position" per symbol, while working in a MT5 Hedging account.
One good thing about this requirement is that its a conversion for complex to simple (as hedging mode is generally more complex due to multiple deals).
here is what the script/function will most likely come out to be
At first, this requirement seems very simple but it really is not, lets look at some examples to see,
Example 1 : For one symbol only -> current lots = -1.00 (-ve is sell) , desired lots = -0.5 (-ve is sell) , the some possible solutions are,
--> open +0.5 (+ve is buy) so net lots = -1.00 + 0.5 = -0.5
--> close -0.5 by Trade_action_close_by so net lots = -1.00 - (-0.5) = -0.5
The above two solutions are both fulfilling requirement in one deal transaction however,
->in the first case we are left with additional trade open which will have to be closed at some point and the solution is not complete without addressing that additional position.
->in the second case there is no additional trade but the problem is that this will not work for desired = -1.00 and current -0.5 as there is no function like Trade_Action_Add_By. so that will result in an additional position as well and which will have to be address at some point.
So, the main thing is so design an algo which is most efficient ( minimum deals, minimum simultaneous positions)
I am hoping that this has been done before and that someone can direct me.
I searched it a lot and the only close thing I found was this,
https://www.mql5.com/en/forum/364404