计算最后一张空单的成交价格的函数模块的写法

楼主  收藏   举报   帖子创建时间:  2019-05-05 05:22 回复:0 关注量:455
计算最后一张空单的成交价格的函数模块的又一写法:
double FindLastSellPrice()
{
double oldorderopenprice=0, orderprice;
int cnt, oldticketnumber=0, ticketnumber;
for(cnt=OrdersTotal()-1;cnt>=0;cnt–)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMagicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber &&
OrderType()==OP_SELL)
{
ticketnumber=OrderTicket();
if(ticketnumber>oldticketnumber)
{
orderprice=OrderOpenPrice();
oldorderopenprice=orderprice;
oldticketnumber=ticketnumber;
}
}
}
return(orderprice);
}

打赏