double startZERO()
{
double BuyLots=0;
double SellLots=0;
double BuyProfit=0;
double SellProfit=0;
int Total=OrdersTotal();
for(int i=Total-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS))
{
if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=Magic_N) continue;
if(OrderType()==OP_BUY)
{
BuyLots=BuyLots+OrderLots();
BuyProfit=BuyProfit+OrderProfit()+OrderCommission()+OrderSwap();
}
if(OrderType()==OP_SELL)
{
SellLots=SellLots+OrderLots();
SellProfit=SellProfit+OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
double Price=0;
double TickValue=MarketInfo(Symbol(),MODE_TICKVALUE);
if(BuyLots>0) double BuyLevel=NormalizeDouble(Bid-(BuyProfit/(TickValue*BuyLots)*Point),Digits); else BuyLevel=0;
if(SellLots>0) double SellLevel=NormalizeDouble(Ask+(SellProfit/(TickValue*SellLots)*Point),Digits); else SellLevel=0;
if((BuyLots-SellLots)>0) Price=NormalizeDouble(Bid-((BuyProfit+SellProfit)/(TickValue*(BuyLots-SellLots))*Point),Digits);
if((SellLots-BuyLots)>0) Price=NormalizeDouble(Ask+((BuyProfit+SellProfit)/(TickValue*(SellLots-BuyLots))*Point),Digits);
if (Price==0)Price=Ask;
return(Price);
}