Backtest with EOD data - how to decide entry/exit point?

Discussion in 'Strategy Building' started by soloist_huaxin, Dec 16, 2015.

  1. I'm new to algorithm trading so please bear with my rookie talk. I want to build a strategy, but the only dataset I have for backtesting is EOD data. My question is, when the strategy generates an entry/exit signal, what is a reasonable entry point? always using the closing price? worst case(HOD for long order, LOD for short order)? best case? random? Please enlighten me.
     
  2. dom993

    dom993

    The entry should always be at the open of the next bar ... I suppose your question is for MKT orders ... depending on the instrument, you can use the open with a couple ticks slippage (that would be the case for most liquid futures), but if you are looking at stocks, a MKT order placed before the open can give you pretty much any fill. What you should do is use a LIMIT order based on the close price (add whatever room you feel comfortable with), and use that as your fill price, IF price did go through that limit (not a touch)
     
  3. It depends!
    What are you trading? Options/stocks/Indexes/...? Liquid/illiquid?
    What is your objective?
    When I back test, my goal is to have the back test results closely approximate what I would expect with live trading. So, you need to understand your entry timing (and a "feel" for how much error this introduces), and a price point (which should allow for slippage, if the slippage would materially impact your trade).
    Your question provides insufficient information to provide much detailed response.
     
  4. I'm trading US stocks/ETFs that are liquid. My objective is to find a reasonable method to determine what entry point should I use for backtesting. I think dom993 has this covered mostly.
     
  5. windwine

    windwine

    One way is to use both EOD and the Open of next day to run the backtest. If the results are similar then you can either place your order around the close or at the next day's open
     
  6. The strategies that I test mostly open new trades based on "closing" data. If you wait till open, you can have (1) missed opportunities, (2) trying to place a trade in a more volatile opening market interval, and (3) since your data source does not have opening pricing, you may be out in the cold for "guessing" at your price.
    You may want to look at your signals, and determine if you are able to enter trades a few minutes (say in the last 15min {5 may be better}) of the trading day, then you may be able to approximate without adding too much error, and get by with EOD pricing as well. -- To paraphrase: If you can realistically determine whether your trade signals will occur a few minuets prior to close, then you can simply back test using closing (EOD) data and test the signal and Trade at that point using the EOD data. -- Your solution may be simpler than you think.
     
  7. lindq

    lindq

    I disagree that you must use the opening of a daily bar. And doing so may severely limit your possibilities.

    Assuming that you have data that includes OHLC, you can access possible entry points anywhere from the open to the low, or the open to the high of that day.

    I'll give you an example. Let's say you want to test an entry that goes long when price is 2% below the open (OP*.98). If your data tells you that the low is greater than .98% of the open, then you know you could have entered at your entry target price, because price would have at least traded down to your target.

    Conversely, if you want to go short, just reverse the logic. A high, for example, that is 5% above your open (OP*1.05), would have given you access to any trade that was at least up to that point.

    The only drawback here is that with daily data you can't access both an intraday entry, and exit within the same bar, because you'll never know which came first. You'll just have to exit at the close, or extend the trade to another day (or days), and can also set exits based on the same techique of trading up to the high, or down to a low. (Be careful in coding that you are not accessing the low or high itself.)

    You can of course broaden your testing to other measures using this same technique. Maybe you want to enter when the low is .97 of the low the day before. No problem. Just code accordingly. If "today's" low is below .97 of the previous day, then you know that could could have entered at your target of .97 below yesterdays low.

    Hopefully that will be helpful.
     
  8. userque

    userque

    It depends upon how the algorithm is optimized.

    For example, if a Neural Network ("NN") is used to forecast closing prices using OHLC as inputs, then your entry will be at the close. That's what the algorithm forecasts.

    OTOH, if a NN is used to forecast opening prices using OHLC as inputs, then your entry will be at the open. That's what the algorithm forecasts.

    Furthermore, if a NN, or two NN's, are used to forecast both the opening and closing prices using OHLC as inputs, then your entry will be either the open or the close, whichever offers you the better entry.

    BTW, you don't have time data as to when the highs and lows have occurred, historically, with basic EOD data--so you won't be able to have entries at the highs and lows unless they happen to also be the opens or closes. The open is always at the same time; as is the close.
     
  9. d08

    d08

    Assuming he's using a free EOD source, he probably has spikes in data which means the high/low for equities is often unreal. Close is the most stable price and the auction carries most liquidity.
     
    soloist_huaxin and userque like this.
  10. I am using a free EOD source, and when I'm running my downloading tool, I see a lot of error message where open/close price is outside of high/low - should I clip the high/low price data since open/close data is generally considered more stable?
     
    #10     Dec 16, 2015