i need the last OpenPrice of a Sell Order and of a Buy Order. I try it with this function but i get only the Price of the last open Order.
Code: Select all
double fk_getLastOpenOrderPrice(double d_OrderOpenPrice)
{
double dOpenBuyPrice ;
double dOpenSellPrice ;
int iAnzOrders = OrdersTotal();
if(OrderSelect(iAnzOrders,SELECT_BY_TICKET)==true){
if ((OrderType() == OP_BUY) && (OrderSymbol() == sSymbol))
{
dOpenBuyPrice = OrderOpenPrice();
}
if ((OrderType() == OP_SELL) && (OrderSymbol() == sSymbol))
{
dOpenSellPrice = OrderOpenPrice();
}
}
if (d_OrderOpenPrice ==1) return(dOpenBuyPrice);
if (d_OrderOpenPrice ==2) return(dOpenSellPrice);
return(0);