out in average openprice + x pips

 
Good morning, I would like to code to go out to the average openprice + 5 pips, in the case or we have several positions. If I put the code below, i go out for all the positions but at the price of the last entry +5 pips and not at average openprice + 5 pips :

if (MarketPositionMN("", -1, -1) ==1 && Close[0] > OrderOpenPrice()+5)
{
CloseAllPositionsComment(Symbol(), OP_BUY, CommntL);
NiveauMoyennageL=0;
}


How calculate the average openprice of all the current trades? If someone could helpme... In easylangage it is enough to use " avgentryprice ", but I begin in MQL4
I thank you.

PS : sorry for my english.
Reason: