Why is my backtest overly optimistic?

Discussion in 'Strategy Building' started by nijshar28, Jun 20, 2020.

  1. I do not know. I don't have intraday data, so it would be hard for me to look into. It is not uncommon for these companies to have wide spreads though, especially on the open and following corporate events.
     
    #21     Jun 20, 2020
  2. taowave

    taowave

    When you say 20 Bps is significant,is that 20 Bps total (in and out),or each way as in 40 bps?

    Either way,I would back out how many Bps you would have to give up to match backtesting with papertrading. Take a snapshot of bid ask spread and see how it relates to your paper trade fills

     
    #22     Jun 20, 2020
  3. 20 bps on each transaction, so probably 40 total.

    Isn't the spread kind of irrelevant since when live trading I will be using auction orders that should give me the same opening/closing execution prices I use in my backtest (provided my orders aren't big enough to impact them)?
     
    #23     Jun 20, 2020
  4. Given that it's a relatively low frequency strategy, I'd venture that you have some sort of forward information that you are subtly taking into account. It's unlikely to be comissions or bid/ask bounce given the frequency. If you are using any information besides the price itself, that might be it.
     
    #24     Jun 20, 2020
    eternaldelight and nijshar28 like this.
  5. d08

    d08

    Double digit Sharpe is confirmed lookahead. Whenever something is too good, I go in with the assumption that it's the code.
     
    #25     Jun 20, 2020
    gueria and nijshar28 like this.
  6. southall

    southall

    But he has been forward testing on paper, so any look ahead should be obvious pretty quick when comparing results on each trade.

    I thought more likely the OP is curve fitting his back tests.
     
    Last edited: Jun 20, 2020
    #26     Jun 20, 2020
    nijshar28 likes this.
  7. I also think it can be survivorship bias of some kind, as I do some extensive data cleaning and exclude some companies from trading based on arbitrary rules (mktcap limits and so forth). I try to follow the same rules when paper trading. But maybe I am still missing something here.

    Here's my plan going forward:

    First, I will try to compare backtest and forwardtest results trade-by-trade as some suggested in this thread, which I have not done up to this point. I only tried comparing things in aggregate, which I agree is less informative.

    Second, I will explicitly test for the fact that my trading universes are the same on a given day between my backtest and forwardtest. This might indicate a survivorship bias.

    Also, I just did a simplified backtest without commissions and so forth in order to test whether my very basic prediction algorithm is biased, or if the bias is introduced later (during NAV calculations).

    In order to test things "simply", I created a dataframe with desired portfolio positions with dates as row indexes and tickers as column names. I then multiplied it by an analogous dataframe with simple price returns for the corresponding tickers and dates. Then summed the resulting dataframe across columns.

    This is the correct basic way of assessing strategy returns, right? Or am I going completely insane?

    The resulting returns series is highly correlated with my NAV calculations (that include commissions, liquidity limits, etc). The cumulative annual returns for the simplified backtest are about two times higher, which makes sense, given that there is no market friction of any kind. But it also indicates that my problem is upstream. This is why I am thinking survivorship.
     
    Last edited: Jun 20, 2020
    #27     Jun 20, 2020
  8. ionone

    ionone

    - does your EA works with any asset with the exact same parameters ?
    - if you change parameters slightly is it still profitable ?(otherwise it's over fitted)
     
    #28     Jun 21, 2020
    nijshar28 likes this.
  9. southall

    southall

    The main cause of overfitting is too many filter parameters.

    Its always tempting to add filters that reduce losses in the past and make the system look great on past data.
     
    #29     Jun 21, 2020
    murray t turtle and nijshar28 like this.
  10. ionone

    ionone

    nope
    you can use 100 parameters and still be fitted
    but you can use 1 parameter and be overfitted
    fitting doesn't depend on the number of parameters, it depends whether those parameters have been chosen to be optimal during a selected period.
    you can overfit a MA with only 1 period parameter.

    you know you're overfitted when you change parameters slightly and it's not profitable anymore. And you have periods like 62, 34, 138, or params like 1.0284, 0.002349 in the settings
     
    #30     Jun 21, 2020
    yc47ib and nijshar28 like this.