Getting the market price out of modified orders

 

Hello all,

I'm writing an expert in which I modify open trades. During the run, I need to know the Market price in the last modification.

The OrderOpenPrice() returns only the first open price and it seems like the modification command doesn't save the market price in the system.

Is there another way to know the prices beside saving them?

Thanks

 

to the best of my knowledge I think there's no single function that will return the price at the time you modified a particular order.

a possible workaround is to save the price whenever you modify an order - either in a file on in an array...

thank you

Automated

--

our news grid trading in action, +531 pips in 24 hours:

http://www.gridtradingcourse.com/videos/news_grid_trading_chfjpy_3/Grid_Trading_CHFJPY.html

http://grid9.forexmosaic.com/ - 8621 pips in 7 weeks of grid trading


 

Thanks,

I solved it with an array, thought maybe there is something predefined that someone would know :)

 

You could also use a variable to collect Ask or Bid price on successful OrderModify() call; Just reset variables to 0 on 0 OrdersTotal() and then use if(ModifyBidPrice>0)

double ModifyAskPrice, ModifyBidPrice;
bool result;


int Start()
{
  if(OrdersTotals() < 1)
    {
     ModifyAskPrice=0;
     ModifyBidPrice=0;
    }

if(ModifyAskPrice > 0)
  {
   // next action after short OrderModify() call
  }

if(ModifyBidPrice > 0)
  {
   // next action after long OrderModify() call
  }



if(TrailingStop>0)
    {
     result=false;
     OrderSelect(12345,SELECT_BY_TICKET);
     if(Bid-OrderOpenPrice()>Point*TrailingStop)
       {
        if(OrderStopLoss()<Bid-Point*TrailingStop)
          {
           result=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Blue);
           if(result) ModifyBidPrice=Bid;
           return(0);
          }
       }
    }
}