How to get open prices for the buy and sell trades seperately?

 
void OnTick()
  {
   if(
      (myMovingAverageArray20[0]>MyMovingAverageArray50[0]) &&
      (myMovingAverageArray20[1]<MyMovingAverageArray50[1])
     )
      
   if(CountBuyPositions()==0 && CountSellPositions()==1)
     {
      trade.Buy(2*Lot,NULL,Ask,0,0,NULL);
     }

   
   if(PositionSelect(_Symbol)==true)
     {
      
      for(int i=PositionsTotal()-1;i>=0; i--)
        {
         
         string PositionSymbol = PositionGetString(POSITION_SYMBOL);   
         double PositionPriceOpenBuy= PositionGetDouble(POSITION_PRICE_OPEN);
         BuyPrice= PositionPriceOpenBuy; 
         int PositionDirection=PositionGetInteger(POSITION_TYPE);
         
         
         if(PositionDirection==POSITION_TYPE_BUY)
         if(PositionSymbol==_Symbol)
         if(CountBuyPositions()==1 && Bid<PositionPriceOpenBuy-(Kademe*_Point))
             {
                trade.Buy(Lot*4,NULL,Ask,0,0,NULL);
                
             }
         
             
          //Comment(PositionPriceOpenBuy);
                    
        }
        
     }
     ////////////////////////////
   
   if(
      (myMovingAverageArray20[0]<MyMovingAverageArray50[0]) &&
      (myMovingAverageArray20[1]>MyMovingAverageArray50[1])
     )
      
   if(CountSellPositions()==0)
     {
      trade.Sell(Lot,NULL,Bid,0,0,NULL);
     }
    

   ///////////////////////////
  
   
   if(PositionSelect(_Symbol)==true)
     {

         string PositionSymbol = PositionGetString(POSITION_SYMBOL);
         double PositionPriceOpenSell = PositionGetDouble(POSITION_PRICE_OPEN);
         SellPrice=PositionPriceOpenSell;
         int PositionDirection=PositionGetInteger(POSITION_TYPE);
         if(PositionDirection==POSITION_TYPE_SELL)
         if(PositionSymbol==_Symbol)
         if(CountSellPositions()==1 && Bid>PositionPriceOpenSell+(Kademe*_Point))
             {
                trade.Sell(Lot*2,NULL,Bid,0,0,NULL);
                
             }
         
          Comment("Buy...",BuyPrice,"...","Sell...",SellFiyat);
      

     }
}
With this code I am able to get the open prices for the buy and sell trades. But if I have multiple trades(buy and sells) open it always shows me the  open price  of the first trade .
How can I get open price for the buy and sell trades at the same time?

Sorry for my English, Thanks in advance.
 

Nobody answered it !

Pretty interesting



PS: I dont know how too :)

 
Instead of PositionSelect, use PositionGetTicket.