shck:
Buy 3.0 lots@1.3515
1.0 lot@1.3525
Sell -6.5 lots@1.3540
-1.0 lot@1.3538
Totally (-6.5-1) + 3 + 1 = -3,5 lots short, but whats the average-price for this position?
Lots weighted price. (3*1.3515 + 1*1.3525 - 6.5*1.3540 - 1*1.3538)/(-3.5)= 1.35651
Buy 3.0 lots@1.3515
1.0 lot@1.3525
Sell -6.5 lots@1.3540
-1.0 lot@1.3538
Totally (-6.5-1) + 3 + 1 = -3,5 lots short, but whats the average-price for this position?
Ok thanks, was a logical error of thinking :-X, because of the long positions is the average price higher than the highest trade price. Strange but brilliant, thank you.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I am surprised that I do not come to a simple algorithm to obtain the net price of a hedge position.
e.g. 2 diffrent EAs, one for long-trades and one for short-trades:
[EURUSD] Open positions:
Buy 3.0 lots@1.3515
1.0 lot@1.3525
Sell -6.5 lots@1.3540
-1.0 lot@1.3538
Totally (-6.5-1) + 3 + 1 = -3,5 lots short, but whats the average-price for this position?
We have 4 lots long positions with an average price @ 1.3517 and 7.5 lots short at 1.35397.
-3.5 lots@??? 1,35318?
I have no plan, with only one direction, it is not a problem, but both directions at the same time
with different sizes...
Many thanks for suggestions.
Warm Regards