Download MetaTrader 5
To add comments, please log in or register
Share your programs. That will improve your rating.
NeilG
65
NeilG 2014.07.20 19:18 

Hi,

I'm trying to code an EA that will not react to the huge spread my broker generates during news.  I realize "guarantee" is a strong requirement so maybe "reduce the impact" is a better.  I know there is a slippage parameter in the OrderSend() function but it doesn't seem to work.

As always, any assistance/suggestions would be appreciated. 

Neil 

Daniel Petrovai
440
Daniel Petrovai 2014.07.21 01:11  
snafu4:

Hi,

I'm trying to code an EA that will not react to the huge spread my broker generates during news.  I realize "guarantee" is a strong requirement so maybe "reduce the impact" is a better.  I know there is a slippage parameter in the OrderSend() function but it doesn't seem to work.

As always, any assistance/suggestions would be appreciated. 

Neil 


The spread you're talking about isn't "broker generated" but more like market generated. The only possible way to enter the market at the price you want is to place pending order before the news . Even so, there is no guarantee your broker will fill your order.

That's my opinion anyway. 

NeilG
65
NeilG 2014.07.21 01:25  
thrdel:


The spread you're talking about isn't "broker generated" but more like market generated. The only possible way to enter the market at the price you want is to place pending order before the news . Even so, there is no guarantee your broker will fill your order.

That's my opinion anyway. 


Thanks thrdel however the order is placed before the news as a pending order.  The problem is that during news, whether "broker generated" or not, the spread increases a great deal which forces a substantial difference in the requested price verses the filled price.  For example, even if the SELL-STOP is place at price 1.1000, it is filled at 1.0090 or lower.  This 10 PIP loss is significant enough on smaller time-frames to negate any profits.

My understanding is that the SLIPPAGE parameter in the OrderSend() is supposed to stop this from happening.  If the difference between the requested SELL-STOP and ASK is greater than the SLIPPAGE, the order should not get filled.   It doesn't seem to work therefore a coding strategy must be used and that is what I need help with.

Thanks,

Neil 

qjol
3243
qjol 2014.07.21 02:47  

a piece of advice: don't trade the news or around that time

if you insist

you can do something like this (example if spread is greater or equal 200 points)

if (MathAbs(SymbolInfoDouble(Symbol(), SYMBOL_ASK) - SymbolInfoDouble(Symbol(), SYMBOL_BID) >= 200 * Point))
return;


B.T.W most of the brokers if not all of them ignores the slippage parameter

NeilG
65
NeilG 2014.07.21 12:01  
Thanks gjol.
Jon Grah
367
Jon Grah 2014.07.21 13:52  

qjol:

.......

B.T.W most of the brokers if not all of them ignores the slippage parameter

Slippage parameter only applies to instant execution.  Market execution does ignore slippage parameter.  OP did not specify who his broker was, or whether or not his account type was market or instant execution.  I'm assuming that it is market execution.
snafu4:


Thanks thrdel however the order is placed before the news as a pending order.  The problem is that during news, whether "broker generated" or not, the spread increases a great deal which forces a substantial difference in the requested price verses the filled price.  For example, even if the SELL-STOP is place at price 1.1000, it is filled at 1.0090 or lower.  This 10 PIP loss is significant enough on smaller time-frames to negate any profits.

My understanding is that the SLIPPAGE parameter in the OrderSend() is supposed to stop this from happening.  If the difference between the requested SELL-STOP and ASK is greater than the SLIPPAGE, the order should not get filled.   It doesn't seem to work therefore a coding strategy must be used and that is what I need help with.

Thanks,

Neil 

I recommend that you handle your order management 'internally' meaning that you let the EA detect the conditions in real time and then offset positions as needed.  If you attempt to use the broker's pending order system, especially during volatile periods, you are setting yourself up for stop hunting, erroneous fills, etc.  Even with an honest broker (ECN/STP or an honest dealer), you still can have negative slippage, especially if you are attempting to exit with the momentum (trying to sell when the market is going down, or buy when the market is going up).  You have much more control if you have your own functions monitoring spreads, and then send a market order to offset when your conditions are met.

There are a very few ECN/STP mt4 brokers who actually have "true" limit orders; meaning that once your pending order is triggered, it becomes a market order (brokers with dealing desk will convert pending to instant order).  You have to ask them specifically if they will guarantee a limit-style order, where you get the requested price 'or better'.  I think years ago Forex.com offered guaranteed stop losses on their accts if you were 50 pips away from entry (5 pips for the pro acct); I don't think any broker is doing that now.

Either way, a talk with your broker will confirm whether they do allow slippage parameter on the stop order.

NeilG
65
NeilG 2014.07.27 20:46  
4evermaat:
Slippage parameter only applies to instant execution.  Market execution does ignore slippage parameter.  OP did not specify who his broker was, or whether or not his account type was market or instant execution.  I'm assuming that it is market execution.

I recommend that you handle your order management 'internally' meaning that you let the EA detect the conditions in real time and then offset positions as needed.  If you attempt to use the broker's pending order system, especially during volatile periods, you are setting yourself up for stop hunting, erroneous fills, etc.  Even with an honest broker (ECN/STP or an honest dealer), you still can have negative slippage, especially if you are attempting to exit with the momentum (trying to sell when the market is going down, or buy when the market is going up).  You have much more control if you have your own functions monitoring spreads, and then send a market order to offset when your conditions are met.

There are a very few ECN/STP mt4 brokers who actually have "true" limit orders; meaning that once your pending order is triggered, it becomes a market order (brokers with dealing desk will convert pending to instant order).  You have to ask them specifically if they will guarantee a limit-style order, where you get the requested price 'or better'.  I think years ago Forex.com offered guaranteed stop losses on their accts if you were 50 pips away from entry (5 pips for the pro acct); I don't think any broker is doing that now.

Either way, a talk with your broker will confirm whether they do allow slippage parameter on the stop order.


Thanks everyone.  Your time and input is appreciated.

 Neil 

/
To add comments, please log in or register