Where to place RefreshRates()?

 

Where to place properly place RefreshRates() to prevent re-quote/off quote?

Should it be before or after?

Are these right?

Where else should I place RefreshRates()? 

 

      RefreshRates();
      double ask   =MarketInfo(Symbol_1,MODE_ASK);

 

 

      RefreshRates();
      int ticket=OrderSend(Symbol_1,OP_BUY,LongLot,ask,slippage,0,0,"My EA",12345,0,Green);
 

Somebody will correct me if I am wrong.

I don't believe that RefreshRates() refreshes MarketInfo data.

As you don't use any of the pre-defined variables in your OrderSend(), I don't see that RefreshRates() is necessary there either. It would be if you were using the chart symbol and Ask and the EA had been calculating for a while.

 
GumRai:

Somebody will correct me if I am wrong.

I don't believe that RefreshRates() refreshes MarketInfo data.

As you don't use any of the pre-defined variables in your OrderSend(), I don't see that RefreshRates() is necessary there either. It would be if you were using the chart symbol and Ask and the EA had been calculating for a while.

Agreed!

@johnnybegoode:

"RefreshRate()" is not needed when using "MarketInfo()" function for the Ask or Bid price because it is always the current up-to-date price. But, if there is a large delay between assigning a value to the variable and then using the variable, you should update it with a call to MarketInfo() again, or just use it directly as the open price parameter in OrderSend().

This will however, not guarantee that there is no re-quote because there will always be slippage. You can also widen your slippage tolerance on the OrderSend() function which should also help.

However, instead of working with brokers offering "Instant Execution" orders, which are usually of the Market Maker (Dealing Desk) type, try to use brokers that are more transparent, that don't cover the opposite side of your trade and that provide "Market Execution". For "Market Execution" there are no re-quotes, and orders will be executed irrespective of how much slippage occurs.

Reason: