Is there a way to test how would a raise of the spread by 1-2 pips would impact an EA ?

 

1) count the number of trades

2) calculate the profit

3) reduce profit by 1* or 2* pips / trade

I do all my back tests & EA work just using Bid price, and treat the spread as a 'cost of doing business'.

Yes, I even calc Long Entry & Short SL based on Bid. That way, both the Entry & Exit points exactly line up with the Bid line.

 
brewmanz:

3) reduce profit by 1* or 2* pips / trade

Very, very optimistic unless your system is very unusual. On most systems this ignores the significant potential for winning trades to turn into losing trades.

Let's imagine a very simple system which places trades with a s/l and t/p of 10 pips. It has a historic trade where it went long at 1.3000, and the trade therefore gets closed if the bid price hits either 1.2990 or 1.3010. If the spread is 2 pips, then the trade opens at a bid price of 1.2998. The trade has to go 12 pips into profit to hit its t/p, or 8 pips into loss to hit its s/l. For the trade to close at profit, the ask price has to hit 1.3012.

However, if the spread is 4 pips rather than 2 pips, then the trade opens at a bid price of 1.2996, and has to go 14 pips into profit to hit the t/p versus only 6 pips into loss to hit the s/l. The trade only gets closed at a profit if the ask price hits 1.3014.

Your system is doubtless much more complicated than this, but I would be hugely surprised if it had no trades where, broadly speaking, some "winners" turn into "losers" because they do not reach their profit target when the spread is widened, rather than the profitability simply being reduced by the value of the increased spread.

EDIT: Other possibilities include extra trades getting taken if the spread is widened. For example, the system places a buy stop with entry at 1.3000. The highest bid price reached is 1.2996. If the spread is 2 pips, then the ask price peaks at 1.2998, and the trade never gets filled. But if the spread is 4 pips, then the ask price does hit 1.3000 and the trade is filled. Extra trades such as this can be either winners or losers, but they've got a nasty habit of being losers...

 
jjc:

Very, very optimistic unless your system is very unusual. On most systems this ignores the significant potential for winning trades to turn into losing trades.

I totally agree with you jjc.
The difference between ASK and BID is what leads to failure even the most complicated systems trying to implement technical analysis: what you see on the chart is always BID... in reality things are pretty much different.

 
Zypkin:

what you see on the chart is always BID... in reality things are pretty much different.

Indeed. My examples ought really to refer to the mid price being fixed historically, and both the bid and ask fluctuating depending on the spread, but even that's not entirely true, and it's also not how MT4's backtesting behaves.
 

When I look at historical pricing information, all I have is BID price. All the charts I examine, it's BID price (apart from current ASK). When I look for algorithms at TP & SL in my charts, all I can see is BID price.

Remember, both my buy & sell points occur at EXACTLY the price shown on the historical chart - the BID price. Does the same apply with your own systems? Many I've seen don't. I can tell from your comments that you are not familiar with the concept of using (BID + Spread) rather than using ASK. Yes, Spread does vary. and as it varies, I change my Order Prices that have to be based on ASK. You seem to have failed to realise that. And when they're too close to market to vary? Then I issue (or close) the order with market price.

No, I don't scalp, trade news or in fast moving markets. I just treat the Spread as the 'cost of doing business'.

So, I don't know why you're going on about how inaccurate it is. I regard planning & testing my systems with BID price as more accurate than guessing what ASK might be.

Unless you have historical ASK price that you can chart in MT4.

 
brewmanz:

I can tell from your comments that you are not familiar with the concept of using (BID + Spread) rather than using ASK. Yes, Spread does vary. and as it varies, I change my Order Prices that have to be based on ASK. You seem to have failed to realise that.

If the spread had been different historically, then all the bid prices would have been different (and the ask prices would also have been different). MT4's backtesting doesn't model this. If you are reliant on entry and exit at absolute price levels, then the effect of a widening of the spread is therefore unknowable using MT4 because the true price history is unknown. It's still not the case that you can simply adjust profitability by the size of the increase in spread. You could have had a different pattern of trades. You just don't know.

Leaving aside MT4's limitations, there are two possibilities: (a) you enter long trades when the bid hits x, or (b) you enter long trades when the ask hits x. In scenario (a), if the spread increases then the MT4 backtester will fill buy orders at different prices depending on the spread. In scenario (b), the modelled ask prices will vary depending on the spread, and some trades may not get taken or extra trades may get taken. In either case, profitability is potentially affected by more than just the value of the spread.

Regardless of all this, even if your system does fit into the category which I described as "very unusual" then it's still... very unusual. Your blanket advice that you can calculate the effect of the spread simply by reducing profit by the number of pips applies to no EA whose code I have ever seen posted on this forum. Your advice might possibly be true for yourself, but on the balance of probability it is very unlikely to be true for other people.

Reason: