Download MetaTrader 5
To add comments, please log in or register
What are the latest MQL5.community news? The Wall section will tell you!
Johnny
140
Johnny 2011.08.09 12:14 

Hi all,

let's say, i made multipe transaction below:

 Buy 500,000 AUDUSD at 1.03756

 Buy 500,000 AUDUSD at 1.03726

 Buy 1,000,000 AUDUSD at 1.03856

 Buy 500,000 AUDUSD at 1.02362

 Buy 100,000 AUDUSD at 1.00192

My total position is now: 2,600,000 . How can i calculate what average price for this position. what formula can i use?


Thanks

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Documentation on MQL5
Andrei Moraru
1143
Andrei Moraru 2011.08.09 12:44  

(5 * 1.03756 + 5 * 1.03726 + 10 * 1.03856 + 5 * 1.02362 + 1 * 1.00192) / 26 = ~1.03384

The general formula is:

(Vol1 * Price1 + Vol2 * Price2 + ... + VolN * PriceN) / Sum(Vol)

Johnny
140
Johnny 2011.08.09 13:32  

Thanks :)
/
To add comments, please log in or register