Trading intraday mean reversion using limit orders – does it work?

This is a follow-up post regarding trading intraday mean-reversion (link). The intention of the initial post has been to gather feedback on the validity of the strategy presented. The initial post has received a lot of valuable feedback. Thank you very much!  With this post I want to pick-up your thoughts and respond to it.

Details matter

Let’s review the initial system again. I made a small though impact-full mistake yesterday. My default settings include 0.01$ / share per trade.   Furthermore my price calculation resulted in Limit-Orders with up to 5 decimals. My broker (Interactive Brokers) only accepts orders with two decimal places. So I rounded to two decimal places. Furthermore I changed the entry criteria from Low <= LE1 to Low < LE, this means the low has to be bellow the entry. This makes especially sense when working with two decimal places only.

By the way, why does Interactive Brokers accept limit orders with two decimal places only but my fills have three decimal places. For me this looks like somebody is making half a cent per trade on my account! Any thoughts, please comment?

.

Average% win size

Some of the feedback I received was related to the average percentage win size as no slippage has been added. So let me show you a few very simple methods to improve the average win size.  First I looked how the results were for stocks slightly oversold (RSI2<50) on yesterday’s bar.  I couldn’t find a real difference in the result. In the next steps I looked at the market, so the system will only trade when the QQQQ’s are slightly overbougth. This made a big difference in the average win size, but has a big cost in terms of annual returns. However you get the point, there are good and bad times for intraday mean reversion. Driving factors are oversold / overbought conditions, volatility environment and correlation of the stock to the index.

.

Trading cost

Let’s add trading cost + commission in order to get to more realistic results. I added to assume for 0.1% commission per round-turn and in a second test i added 0.05% slippage per round-turn

.

Some other comments

  • Some of the comments were related to liquidity and fill assumption beyond 100k.  The test is done on NDX100 stocks only. Furthermore my personal account size is a drop in the ocean compared to volume of NDX100 stocks.
  • Orders (+execution) right at the open might be an issue. I run a test where I excluded trades with low=open. Average results dropped slightly to about 0.65% per trade (from 0.68%).
  • Data quality: spikes in high/low. That’s indeed an issue for further research.

.

System execution

A topic I would like to cover specifically is how to execute the system presented. Developing a system is one thing, executing is another thing!

The key question: when will the limit order be placed?
  • Prior the open: As you don’t know what stocks fall bellow the entry criteria you have to set limit orders for all NDX100 stocks. While this is technically possible the broker won’t allow you to do this as this will likely exceed your margin level. So you have to find a way to identify the stocks that are most likely to fall bellow the limit order (and mean revert)
  • Real-time, automated:  You can place the order as the limit get’s hit (theoretically)  and bet that the limit will be hit again. This requires you to have a pretty good (fast + reliable) IT environment   (suddenly you are in competition with the BIG boys).
  • Real-time, discretionary:  You have your software constantly scanning the stocks and giving you an alarm signal when the limit is hit. This has the advantage of being able to buy the stock only when it has finally bottomed-out. A discretionary trader will miss many opportunities as he is slow in execution (capture the event and enter the order)

.

Reality check!

Bottom line: for a (non-automated) system trader the system has to be re-designed. I re-wrote my code in a way that the system will place five limit orders prior the open (regardless if the limit order will be hit next day or not) … stay tuned for another post!

About these ads

Comments

  1. Thierry says:

    Interactive brokers is taking half a cent because these are their fees!

  2. Alfred says:

    I have been executing a similar system for 18 months using a wider universe of stocks (not just N100) and some different filter settings. Filters are:

    previous close above 200 MA
    RSI(2) of previous close 50 and the limit order has a ‘good after’ date/time so that it only gets placed 2 minutes before market close.

    Note that to execute this system, I don’t need to be online at all during the trading day and I don’t need an automated program to manage the trades (can all be done through the mechanics of the order system). Purchases happen intraday on the limit orders and the OCA ensures I don’t go over my margin. The EOD trade means I can get approximate EOD prices at limit. All orders are placed before the market opens. A trade is always held at least 1 day because I don’t exit on the same day the order was placed.

    It works. Backtesting shows an average percentage gain of about 1.5% and a win rate of about 70%. I have been tracking the predicted results next to results achieved. There is sometimes slippage, missed trades etc. However, the results are in line with the theoretical ones – certainly enough to be profitable. Slippage can be caused by:

    o) Opening auction can give you a worse price than the published open, but it can also get you a better one. Seems to balance out and not be significant
    o) EOD price can similarly affected but could be better or worse than published prices
    o) Because OCA can only deal with groups, sometimes it cancels orders that will have been filled in the backtesting system
    o) Sometimes orders are not filled even though the trade price was reported as being low enough
    o) Sometimes the sell order is not filled for a similar reason as above, leaving you exposed to the market for another day. That can make a significant difference to the model, either + or -ve

    With highly liquid stocks, the above problems cause only small differences between the model. However, with lower liquidity they can be substantial although not necessarily unprofitable. The problem is when the trades don’t match your model you lose confidence.

    I have recently cut out low liquid stocks because they were too unpredictable. I’ve also been dabbling with a d*ATR(20) entry price instead of %d and it seems to slightly improve results.

    My biggest problem is deciding position sizes. I’ve found it hard to analyze what gives the best risk reward ratio. The system spends most of its time in cash, and then candidates all show up at once when the whole market drops. Also, the lower volatility stocks should get more cash than high ones, but this is also difficult for me to model.

  3. Alfred says:

    System screwed up part of my post. Top part should be:

    I have been executing a similar system for 18 months using a wider universe of stocks (not just N100) and some different filter settings. Filters are:

    previous close above 200 MA
    RSI(2) of previous close < 5

    Each day this selects a set of stocks that varies from 0 to 100s. I then place limit orders on every one at %d below the close with a OCA groups set so that only a maximum number of orders could execute (say 8 maximum).

    I also exit on limit orders with the price set at RSI(2) > 50 and the limit order has a ‘good after’ date/time so that it only gets placed 2 minutes before market close.

  4. Terry says:

    Alfred,
    Thanks for sharing. How does OCA handle it when the market tanks and all of your limit orders trigger simultaneously?

    Terry

  5. Terry says:

    Alfred,
    Ignore my question above, I was just assured by my broker that it is not an issue. If you are will to discuss how you do groupings, please email me at burger4wimpy at yahoo.com

    Thanks
    Terry

    • Alfred says:

      Right, that has never happened. I use Interactive Brokers and there has never been an execution in violation of the OCA in the past 18 months.

      Grouping is quite simple. Say you want to limit your exposure to 5 positions and there are 20 candidates. Simply create 5 groups like this OCA1, OCA2 … OCA5. Then randomly assign limit orders to each group so there are 4 in each. Then you can be assured that a maximum of 5 will be opened in the trading day.

      As mentioned above, the downside is that if the model opens 2 positions (say) and you had them in the same group, you will only enter 1 of them. In practice, this has not happened very often – and it is a small price to pay for the simplicity of this system.

      BTW, I semi-automate the order entry. Amibroker finds the daily candidates in the Explorer window. I have c# program that enters them into Interactive Brokers using its API. This reduces the time spent on executing the system daily and reduces the chance of data entry errors.

      • Hello Alfred,

        this is excellent feedback! Thank you very much … that’s why I write this blog.

        Frank

      • JonnyB says:

        I’d be careful relying entirely on those OCAs. If there is a severe intraday market crash you can absolutely get filled on all of them…if you read your brokers website, it will state that the cancels are not guaranteed. Ironically, that is when you will need them the most. A little quick math shows how scary this can be…especially in a margin account. Imagine being 4x levered long as the market tanks 20%….ouch.

  6. Gonzaga says:

    Alfred,
    Is very interesting your way of purchasing
    As I’ve told before, I have been using a similar system last year, and my real results has been different from the backtest’s ones.
    My system has been different:
    I purchase in intraday up to ten stocks that have dropped much below Bollinger bands.
    I look during the day about 1000 stocks to purchase any of them that drops so much, in a limit order below its bollinger band.
    Obviously, I can not establish 1000 limit orders, so I have an Excel program scanning the 1000 stocks every 20 seconds, and sending the orders of the ten chosen stocks.
    What’s been the problem: In the days that markets falls very hard, the 10 bought stocks are the stocks that drops very much, usually in the first minutes of the session.
    But Amibroker does not buy the same stocks in those days. Initially, the backtest buys the stocks in alphabetical order. Of course, the stocks are different, mainly in the hard-falling days.
    That has been a big difference between real market and the backtest.
    Your solution I think is better than mine. But I guess you should have this problem also, although not so heavy as me.
    In every 5 stocks OCA group, the stock you really buy shouldn’t be always the same as backtest, but the stocks that have drop more quickly. In volatile days, that stock use to be worse than stocks that fall more slowly.
    Haven’t you feel this problem in falling markets? For example, last May?
    Also, what’s been the CAR results, more or less? You can send this answer to my e-mail (gonzagag -at- gmail.com) if you don’t want to public in the web, and I’ll send to you my own results and code. If you like, of course :-D

    anyway, congratulations for your fantastic work..

    • Alfred says:

      Hi Gonzaga,

      I have not ever suspected that fast falling stocks are less likely to mean revert than slow falling ones. It may just be that my selection criteria, which sounds like it selects fewer stocks in the first place, is not subject to that effect, if it exists. Even on days where a large number of positions have been entered on the same day, the results match those bought by the model with the occasional miss of a seemingly random position which could have otherwise won or lost.

      In terms of performance, I have seen a total gain of 72% (in 18 months) with a maximum drawdown of -18% (in January 2010) (I am in -5% drawdown right now). This includes commission and slippage. However, I have changed my system quite a bit over that time. I’ve now dropped low volume stocks altogether because the returns were erratic and produced too many trading mistakes. By ‘total gain’ I mean the cumulative daily gain of the capital I allocate to the strategy. It is very rare for the entire capital to be in stocks and in fact it is far more usual to have no positions open at all.

      My biggest problem is money management – how to select the number of ‘slots’ to use. Optimizing in Amibroker suggests you get the best risk adjusted return when you have a smaller number of slots (say 2 slots with 50% of the capital) than you get with a larger number (say 5 slots with 20%).

      The fairest measure seems to be the average % gain per trade which doesn’t change with your money management policy. From January – August 2010 I achieved 1.62% per trade on 92 trades (after commission). Biggest win: 23.53%, biggest loss -26.23%.

      • ChartRider says:

        Hi Alfred,

        thank you for sharing. My first experiences with a similar system on IB-simulation-account also shows erratic results in order execution (mainly MOC and MOO order) with low volume stocks. What is your threshold to dropp “low volume stock” to avoid this effect, is it about 500000 dollar per day, 1 million dollar per day, 5 million dollar per day or 10 million dollar per day?

      • Alfred says:

        Well I used to trade very low volume stocks. We’re talking OTC or AIM listed stuff (although very small positions). I don’t any more though due to inability to execute cleanly at market prices. Although this did produce profitable results, the hassle and stress was not worth it.

  7. I really appreciate your post and you explain each and every point very well.Thanks for sharing this information.And I’ll love to read your next post too.
    Regards

Trackbacks

  1. [...] KPI Posts Comments ← Trading intraday mean reversion using limit orders – does it work? [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 277 other followers

%d bloggers like this: