A function to get the price of the last open trade :

Code:
double lastprice(){
   double price=0;
   for(int j=OrdersTotal()-1;j>=0;j--){
      if(!OrderSelect(j,SELECT_BY_POS))continue;
      //if(OrderType()==ordertype)
         if(OrderMagicNumber()==Magic)
            if(OrderSymbol()==Symbol())
               if(OrderType()==OP_BUY || OrderType()==OP_SELL){price=OrderOpenPrice();return(price);}
   }
   return(0);
}