以下模块是MT4的,求助各位大神们把它转为MT5该怎么写?
double 计算平均价格(int mNumber)
{
double AveragePrice = 0;
double Count = 0;
for(int i = 0; i < OrdersTotal(); i++)
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderSymbol() == Symbol() && OrderMagicNumber() == mNumber)
if(OrderType() == OP_BUY || OrderType() == OP_SELL)
{
AveragePrice += OrderOpenPrice() * OrderLots();
Count += OrderLots();
}
if(AveragePrice > 0 && Count > 0)
return(NormalizeDouble(AveragePrice / Count, vDigits));
else
return(0);
}
|
|
|
|
|