Download MetaTrader 5
To add comments, please log in or register
Share your programs. That will improve your rating.
Christian Köchy
36
Christian Köchy 2014.02.05 13:19 
Hi,

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
whroeder1
13627
whroeder1 2014.02.05 15:25  
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
Christian Köchy
36
Christian Köchy 2014.02.05 15:48  
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.
/
To add comments, please log in or register