Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
jon
421
jon 2016.10.01 23:40 

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);
Keith Watford
Moderator
7907
Keith Watford 2016.10.02 00:43  

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.

Fernando Carreiro
1458
Fernando Carreiro 2016.10.02 00:58  
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.

/
To add comments, please log in or register