On-Close Trading with LOC & MOC Orders

In a previous post I discussed how to implement in real trading a strategy back-tested on the close (the signal is generated on the close and the trading is performed on the close too). The main tool was pre-computing what I call tables of actions. In my opinion, the complexity of implementing a strategy in real trading depends on the types of tables of actions the strategy generates, and in this post I am going to show you a system which can be implemented using only the two on-close orders provided by Interactive Brokers and other retail brokerages.

The two orders are Market-On-Close (MOC) and Limit-On-Close (LOC). The first is a unconditional market order executed on the close. The second, is also executed on the close, but only if the close is equal or lower (for a long order) or equal or higher (for a short order) than the limit price.

Now, back to the strategy definition. The obvious observation is that a table of action without an inflection point, i.e. a single action for the entire interval, is implemented by MOC orders. Here is an example:

Close Pct Position
$119.79 -10.00% Short
$146.40 10.01% Short

The above table indicates that for any price change from the last close, the desired position is short. If the current position is short, we don’t have to do anything, if the current position is long, we need a single MOC order to flip the position to short. A variation is that sometimes we want to adjust the position size, for example using some risk method. Even with this twist, we don’t need more than a single MOC order to increase or reduce the size of the position.

The next observation is not so obvious – if the table of actions has a single inflection point, with a desired long position for closes lower than the inflection point, we can still implement it using only LOC and MOC orders. Here is an example of such table of actions:

Close Pct Position
$119.79 -10.00% Long
$132.73 -0.28% Short
$146.40 10.01% Short

The above table commands a long position if the close is equal or below $132.72 and a short position if the close is above or equal $132.73. The reason this table of actions is suitable for LOC orders, is because for short orders, the limit indicates the minimum price and the limit indicates the maximum prices for long orders. See what happens if the the desired positions are flipped.

Let’s first review a concrete example without changes in the position size. Let’s assume that currently we are short a 100 shares. For the above table of actions, we can put a single LOC order to buy 200 shares (to flip the position) with a limit of $132.72. We will stay short if the close is above $132.72, and we will go long 100 shares otherwise. That’s all.

Next, let’s complicate things a bit – let’s assume that the next position needs to be 110 shares. Now we need two orders. First, we will put a LOC sell order with a limit of $132.73. This takes care to expand the short position if the close is above the inflection point. The other order is a LOC to buy 210 shares with a limit of $132.72.

We aren’t done yet – the most interesting case is when the position is shrinking. Let’s say the desired size of the new position is 90 shares. What do we do now? Notice first, that we want to buy 10 shares (100-90) regardless of where the close is. Ok, so that’s a MOC to buy 10 shares. This is sufficient to take care if the close is above or equal the inflection point – we will end up with 90 shares. To cover the other possibility, close below the inflection point, we need a LOC order to buy 180 (90+90) shares with a limit of $132.72.

Of course, if the current position is long, the approach is different but easy to workout too.

What strategies generate such table of actions? Not many. Unfortunately a simple moving average system generates the opposite table of actions – the longs are above or equal the inflection point. These table of actions are generated by oscillators.

So, why bother if these table of actions are rare? Well, because even a more complex system (like my beloved ARMA+GARCH) may end up generating a table of actions like that on some days. When that happens, trading is very easy and can easily be done by a program. The trades can be entered at any time during the day (these are LOC and MOC orders) and can be verified later. This way, a manual intervention is needed only on the more complex days.

Leave a Reply