double NullPriceForGread(int type)//функция нулевой цены (безубыток) сетки ордеров
{
double lots = 0;
double totaLots = 0;
double openPrice = 0;
double prom = 0;
double NullPrice = 0;
for(int i=PositionsTotal()-1; i>=0; i--)
{
if(m_position.SelectByIndex(i))
{
if(m_position.Symbol() == _Symbol)
{
if(m_position.PositionType() == type)
{
lots = m_position.Volume();
totaLots += m_position.Volume();
openPrice = m_position.PriceOpen();
prom += lots * openPrice;
}
}
}
}
if(prom > 0 && totaLots > 0)
NullPrice = NormalizeDouble(prom/totaLots, _Digits);
return(NullPrice);
}
//+------------------------------------------------------------------+