Enter and Exit at the Close in Amibroker and Tradestation (Daily Bars, OPG, and MOC Strategies)

How to enter and exit positions are important in trading – perhaps one of the most important aspects of trading. How do you enter and exit a trade? We all know commissions can eat into the profits, but slippage might be a much bigger cost. If you’re a long-term investor, slippage is a negligible problem but not for short-term traders.

How do you most efficiently enter and exit positions? Should you buy at the close – market-on-close –  (MOC)? Or is it better to buy on tomorrow’s open (OPG)? Or even put in a limit order? In this article, we briefly look at some aspects of these “problems”. We think the most rational approach (most of the time) is to enter at the close.

To buy/enter at the close (by not using an on-the-close order)

Most readers are probably aware that we usually enter a position at the close. This is, of course, kind of impossible because we don’t know the closing price before it has actually happened. If you want to use an at-the-close order you need to send it before the market closes, obviously.

MOC market-on-close order

On most exchanges, there are auctions that set the final price of the day. In the stock market, such an order is a MOC market-on-close order. Such an order needs to be sent a certain time before the close, in most places around 15 minutes. NYSE sets the limit at 15.45 while Nasdaq sets it at 15.50. The order is a market order.

Because we don’t know the closing price at that time, we can’t use such an order.

If it’s impossible to trade on the close, why do we still make strategies based on an entry at the close?

It’s of course easy to test strategies based on the closing prices, but in real trading, you need to program to