Effect of spread on backtests

Forums ProRealTime English forum ProOrder support Effect of spread on backtests

Viewing 8 posts - 1 through 8 (of 8 total)
  • #52478

    I’d like to know exactly how the spread setting is used when backtesting a strategy. I wrote a simple strategy on the GBPUSD which had a 60 pip take profit and a massive stoploss and set the spread to 2.0 thinking that that normal trading hours spread is 0.9 but 2.0 would give allowance for slippage and maybe some overnight fees as a wider spread would give more back to the market on each trade. The strategy was profitable and had a fairly straight equity curve. I reduced the spread setting to 0.9 and suddenly the strategy is less profitable by a long way and has a very erratic equity curve. My brain says that with less spread the strategy should be more profitable so how can this be? Are backtests calculated on a mid price and then the spread setting applied or are backtest actually calculated using bid and ask prices?

    #52483

    check trades if you have more trades with 0.9?

    maybe with 2 you miss some losers?

     

     

    #52485

    Yes there is obviously a difference in number of trades and winners and losers but what I am really interested to know is how the ‘Spread’ setting is applied. Does the tick by tick data use actual bid and ask prices or does it use a mid price or a bid price or an ask price and then add or subtract your chosen spread to get bid and ask prices? I’m guessing the latter otherwise why have a spread setting? If this is the case then true market prices will be very different to those calculated as spread can change from day to day, year to year or second to second and this makes back-testing with a fixed spread completely pointless. Confirmation on this ‘Spread’ setting and how it is applied would be most useful!

    #52559

    i dont think you can use bid and ask in backtest only midprice and some extra distance?

    as we know in real trading its the bid and ask that triggers the trades and with forex and variable spread its hard to backtest that

    the best thing is to try it on demo

    this subject has been up for discussion before so you may find some answers there?

     

     

    #52580

    Thanks for your reply Eric. I did a quick search and found the previous discussion on this subject. It seems to confirm my fears that backtesting should be taken with a pinch of salt unless it is a strategy that passes all testing with flying colours and makes a shed load of money. A strategy with just a slight edge when tested is unlikely to perform anything like the test results when put live due to the differences between the real world spreads and the backtest spreads.  Ho-hum – just another major obstacle on the road to riches!

    #52617

    While that may be true it only applies to the difference between backtesting and running live, it  wouldn’t explain the differences you are seeing.  If you don’t mind sharing the code I will take a look and see what may be causing it.

    #52627

    Thanks for the offer to look at the code AutoStrategist. Unfortunately I have mutated the original code into a different beast now and cannot remember how it was when I noticed the spread issue. I’ve tried to reverse engineer it back to where it was but without success. A couple of computer/PRT crashes that lost half a days work each time didn’t help either!

    #52638

    Ok no worries, I was curious to see what was causing it, if only it was as easy as making the spreads wider to make more money 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login