Unable to get execution price in IB automated trading

if( LastValue( Ref(Buy,-1) ) AND Orderstatus!="buy" )  
{
    if( ibc.GetPositionSize( Name2 ) ==0 ) 
   {   
      OrderID_buy = ibc.ModifyOrder( OrderID_buy, Name2, "BUY", 5, "MKT", 0, 0, "Day", TRUE );
      PopupWindow(OrderID_buy,"Alert for order_id",120);
      exec_price_buy=ibc.GetExecInfo(OrderID_buy,"Avg. Price");
      PopupWindow((NumToStr(exec_price_buy)),"Alert execution price",120);
   }
..............
}

When i run the above code, everything runs smoothly except that it displays execution price as 0.00. Is it possible the time in which the ib fetched the exec_price , my code already has moved on the next line, therefore displaying 0 value.

@Tomasz
I figured out that i was not getting execution price is because order was not filled and Amibroker execution moved to next line. Basically I checked the state of order to know this.
So my question is if i want to send a stop order after my buy order gets executed based on my buy order execution , what would be the most efficient of doing it. I have coded the following :

if( LastValue( Ref(Buy,-1) ) AND Orderstatus!="buy" )  
{ 
   ibc = GetTradingInterface("IB"); 
    //check if we are connected OK 
   if( ibc.IsConnected() ) 
    { 
        //place orders only if we do not have already open position on this symbol 
      if( ibc.GetPositionSize( Name1 ) ==0 ) 
       { 
          //retrieve orderID from previous run, will be empty if no order was placed before   
          OrderID_buy = StaticVarGetText("OrderID"+Name1+"buy") ; 
          OrderID_buy = ibc.ModifyOrder( OrderID_buy, Name1, "BUY", 75, 
                                 "MKT", 0, 0, "Day", TRUE );
          state=ibc.GetStatus(OrderID_buy);
         // While loops helps in waiting till the order gets filled
          while (state!="Filled")
          {
		  state=ibc.GetStatus(OrderID_buy);
          }
          exec_price_buy=ibc.GetExecInfo(OrderID_buy,"Avg. Price");
          OrderID_stoploss=ibc.PlaceOrder(Name1,"Sell",75,"STP",0,exec_price-2*ATR(14),"Day",True); // Order is going fine..need to value as a variable

          //store orderID for next run so we know which order to modify 
		  StaticVarSetText("OrderID"+Name1+"buy", OrderID_buy);
          StaticVarSetText(Name1+"Order", "buy"); 
       }      

    }