Bar based Autotrading

Discussion in 'Automated Trading' started by walterjennings, Oct 14, 2010.

  1. I've been using historical OHLC bars to design and build trading systems for quite some time. The downside of using bars is that in order to back test correctly, you need to maintain the same trading values through the whole current bar, so if I was trading 5min bars, I would need to use static trade levels from the previous 5min bar since I don't know exactly how things happens within the newest bar.

    One thing I've always noticed is that by changing the trade levels to calculate using the latest bar, profitability significantly goes up. A major cause of this is because those levels trade anywhere within that newest bar, but uses data from the end of it, ie being able to see into the future. Which makes the performance change completely unrealistic. But I have a nagging suspicion that there might be a real performance increase from using the more dynamic / reactive trade levels obtained by using the current bar, even though it would be impossible to back test.

    Does anyone with experience dealing with this phenomenon have any insights which might help me?
  2. Use tick data.
  3. LeeD


    walterjennings, if you use data from the end of teh last bar and assume execution on the same bar, it's looking into the future which makes any backtesting results completely unrealistic.

    If you are so concerned about execution levels, try using an aggressive limit order to enter on the next bar.

    If you can get hold fo tick data, it's a big plus. Given writing bar-based systems is way easier, you may consider using 15-second or even 1-second bars to produce signals.
  4. I know changing my trade level calculations from previous bar to current bar will cause it to 'look into the future' in backtests. But I confident in my previous bar calc backtests and am looking for new ways to increase the profitability of my system slightly.

    One way I thought that might be possible is switching to more reactive trade levels by calculating them using the current bar rather than previous, this of course will mean the system will not be backtestable, but may perform better. I am wondering if any ETs has made the jump from previous bar calculations to live calculations and what they have found doing so.
  5. Eight


    Tradestation has "look inside bar" features that can trade or test your strategy as if in realtime... I have used tick data and developed bars inside my strategy before, that way I have complete knowledge of what the code is doing...

    By far the best strategy I ever developed was using the Stochastic as if I knew what it was going to be at the end of the bar, wow, that thing was spectacular... the joke was on me, I was doing everything I could to avoid looking into the future but I had a stochastic calculation buried in the code and it was presenting end of bar results!!
  6. You're not the Lone Ranger here. :eek:
  7. Unfortunately I simulate my systems in indicators. So looking inside bar strategy simulations wouldn't work for me. I guess the question is, if you have a system that is profitable running levels at bar X-1, slightly less profitable running at bar X-2. If you were to move the level calculation to bar X (the live bar), would you expect to see a further performance increase (during live trading, not backtesting).

    So as far as backtesting is concerned. I am not interested in testing at a tick level. Merely interested in the change in forward live testing performance change when running a back tested bar system on the live bar.
  8. I'm not following your explanation here. If you have tick data, you can simulate any bar length and indicator. The only thing back-testing with tick data wont tell you is what fills you would get.

    Where am I wrong here?
  9. Backtesting this sort of thing is very difficult and may end up being a huge waste of time.

    I think another poster made a comment regarding limit orders from the previous bar. IMO, there is no other way you could do this.

    If I am wrong could you explain a bit better what you are doing? Honestly, it didn't make a lot of sense to me after I scanned over it a cpl times.
  10. Sorry, I am horrible at explaining myself sometimes. I understand it would give me faster reacting levels + more accurate back tests if I converted all my systems over to Tick level. I am not interested in investing the time and money at this point and prefer to just discuss the idea of improving the current bar based system's real life performance, ignoring the limitations of back testing.

    I am looking for intelligent insight on the following hypothesis from people who have experience trying this:

    Hypothesis H: Systems trading using newer (more relevant data/information) will generally out perform systems which trade using more outdated data/information.

    If system A ran on the newest bar X, using price levels from bar X-1, produces positive profit curve P(A,X,X-1).

    We are unable to use the back test profit curve of P(A,X,X) to gauge its potential. This is because trading on newest bar X using price levels calculated from newest bar X gives unobtainable performance, since that allows the system to 'see into the future', since trades happen between the end of X-1 and the end of X, but the price levels get generated at the end of X.

    We notice that we obtain a less desirable profit curve from running P(A,X,X-2), which would lend to the idea hypothesis H.

    The question becomes, even though we can no longer back test P(A,X,X), would we expect to see a similar improvement in profit curve (running live) that we saw from moving from P(A,X,X-2) to P(A,X,X-1)? Where P(A,X,X) continuously updates trade levels intrabar based on the newest information.
    #10     Oct 15, 2010