MOC (Market-on-Close) Order
A market-on-close order, or MOC order, is a market order that waits for the closing auction and executes at the official closing price. It has no limit price. The broker queues it, and the fill is whatever price the exchange sets when it crosses the day's accumulated buy and sell interest. Brokers close the window for submitting these orders a few minutes before the close, so the order has to be in early.
The order exists because the close is the deepest liquidity moment of the session. A closing auction gathers a day of interest into one print, and index funds, daily-bar strategies and anyone who benchmarks to the closing price tend to trade there. A regular market order executes at once at the best available price. A MOC order gives up the timing and takes the closing price in return.
No backtest here simulates MOC fills. The backtests in the DeployQuant library fill orders on minute bars, and most of the 12 templates are written to act at the open, using the previous close to decide. In place of a MOC test there is a measured description of the close and the open on six real funds: SPY, QQQ, TLT, TQQQ, IWM and UVXY, from 2021-01-04 to 2026-10-02. The numbers show how much happens between one close and the next open, how much of a fund's return arrives overnight, and how thin or deep the liquidity is around the close. Those are the quantities that decide whether trading at the close is a good fit for a strategy.
All results quoted here are hypothetical and come from one window of 5.74 years. They describe what these funds did, and they do not predict what any order will receive.
How a MOC order works
There are three steps. The trader or the program submits the order before the broker's cutoff, with a side and a share count. The order sits unfilled while the regular session runs. At the close the exchange matches all MOC interest with other closing-auction interest at a single price, and every MOC order in that stock fills at that print.
The features that matter for a strategy follow from that sequence.
- The fill price is the official closing price, the same figure that daily-bar data providers record as the close.
- The size of the order is fixed before the price is known, so a MOC order fills at the close with no promise about where that price sits relative to the last quote.
- The order cannot react to anything that happens after submission. A program that sends it a few minutes before the close has committed to the trade by then.
- Brokers set the submission deadline, and the definition for this term states that it falls minutes before the close. Orders that arrive late are rejected or handled as ordinary orders, depending on the broker.
Where a broker does not support MOC orders natively, platforms emulate the behaviour by sending a market order shortly before the close. The emulation is close to the real thing on a liquid fund and drifts from it on a thin one, because the last minutes of trading are not the closing auction. The difference between the emulated fill and the official close is a slippage cost that the backtest on daily bars does not see.
The broker pages in the library cover Webull, Charles Schwab and Alpaca, the three brokers DeployQuant connects to, and the Q&A on which broker is best for automated trading deals with choosing among them. Which order types a given broker accepts is a question for that broker's own documentation.
Why daily-bar strategies care about the close
A daily-bar indicator is computed from closing prices. A 200-day average, an RSI(14), a 63-day return and a 20-day high all take the close as their input. The signal is only complete once the close prints, and that creates a timing problem: by the time the number is known, the auction is over.
There are two ways out. The first is to trade the next day. The rule decides after the close and sends a market order at the next open. The templates in the DeployQuant library work this way. The trend and trailing stop rule on USDU, for example, enters when yesterday's close is above the 200-day average, and it buys at the open. The EMA 12/26 rule buys at the open when the fast average is above the slow one. The decision uses a closed bar, and the order uses the next session's price.
The second way is to estimate the close from a bar that has not finished. A program evaluates the indicator a few minutes before 4:00 pm, using the latest price as a stand-in for the close, and sends a MOC order. The fill then happens at the real close. If the price moves in the last minutes, the real close can sit on the other side of the indicator's threshold, and the trade is one the finished bar would not have signalled.
The first method has a clean record: every decision is made from data that is final. Its cost is the overnight gap, since the position is entered at the open and not the close. The second method trades at the same price the signal was computed from, at the cost of acting on an unfinished number. Neither is free, and the size of the gap decides how much the first one costs. The next section puts figures on it.
What happens between the close and the next open
The average overnight gap in each fund, measured from one close to the next open, was 0.44% for SPY, 0.59% for QQQ, 0.54% for TLT, 0.61% for IWM, 1.78% for TQQQ and 2.53% for UVXY. The average daily range from low to high inside the session was 1.15% for SPY, 1.58% for QQQ, 0.94% for TLT, 1.75% for IWM, 4.74% for TQQQ and 7.03% for UVXY.
For SPY the typical gap is a sizeable fraction of the typical range, and for TLT and IWM it is also large next to the range. A strategy that enters at the open instead of the prior close accepts a price difference that is large next to what the day itself moves. A daily-bar rule on a fund with a gap this size does not get the price that produced its signal.
The gap can help or hurt. On average over the window, buying at the close and selling at the next open would have earned the overnight return, and buying at the open and selling at the close would have earned the intraday return. The figures in the data split each fund's log return between the two:
- SPY: overnight 49.65%, intraday 29.84%, a split of 62.46% overnight and 37.54% intraday
- QQQ: overnight 58.29%, intraday 31.89%, a split of 64.64% and 35.36%
- TQQQ: overnight 97.97%, intraday 32.89%, a split of 74.87% and 25.13%
- TLT: overnight -70.11%, intraday 18.78%, a split of 136.58% and -36.58%
- IWM: overnight 69.84%, intraday -27.57%, a split of 165.24% and -65.24%
- UVXY: overnight -335.95%, intraday -399.82%, a split of 45.66% and 54.34%
The pattern for the three US equity index funds is the same: most of the return came overnight. For SPY, QQQ and TQQQ the overnight leg was the larger of the two. IWM went further. Its intraday leg was negative at -27.57% while the overnight leg was 69.84%, so across the window the whole gain arrived between a close and the next open. TLT shows the reverse sign pattern: a loss overnight of -70.11% and a gain intraday of 18.78%.
The consequence for a MOC order is direct. An order that fills at the close captures the overnight leg that follows it, if the position is held. An order that fills at the open captures only the intraday leg of that day. A strategy that always trades at the open and holds for several days gets the overnight legs in between, so the entry price matters for one day's worth of return, and the strategy keeps the rest. On a rule that holds for months the choice is a small share of each trade. On a rule that holds only a few days, such as the RSI(2) snapback, it is a larger share. These splits describe one window and do not say the pattern persists.
Liquidity at the close on six funds
The closing auction is attractive because of the volume that passes through it, and the volume differs a great deal between funds. Average daily dollar volume was $30,453,859,411 for SPY, $18,772,024,579 for QQQ, $4,150,045,180 for TQQQ, $5,885,548,447 for IWM, $2,159,787,473 for TLT and $458,284,172 for UVXY. The median minute traded 107,870 shares in SPY, 77,976 in QQQ, 285,786.5 in TQQQ, 46,034 in IWM, 35,636 in TLT and 1,145 in UVXY.
For a sleeve of $10,000, the order is a small fraction of any of these figures, including UVXY's. A MOC order of that size in SPY or QQQ would make no visible difference to the closing print. In UVXY the median minute is only 1,145 shares, so thin trading is a reason to treat the closing fill with more caution than in the larger funds. The difference between a good emulation and a poor one shows up in funds like that.
Liquidity matters for the order type more than for the strategy. A MOC order on a deep fund fills at a price that is hard to improve on. A near-close market order on a deep fund fills close to the closing price. On a thin fund, a near-close market order can fill several ticks from the auction price, and the gap between the two is a cost that comes on top of any commission. The cost runs in the library add 5 and 10 basis points to every fill as a stand-in for that kind of friction, and the headline runs add nothing.
The volume figures also explain why the order is favoured by index funds. A fund that tracks an index wants the closing price, because the index is computed from it, and the closing auction is the one moment when enough shares trade to absorb a large order. A $10,000 sleeve has no such need, though it receives the same price as everyone else in the auction.
How a wide close-to-open gap changes the picture
The six funds differ widely in how much the price moves, and that decides how much the entry price matters.
SPY had annualized volatility of 16.41%, a maximum drawdown of 24.51% from 2022-01-03 to 2022-10-12, and a CAGR of 15.2%. QQQ had volatility of 22.39%, a maximum drawdown of 35% from 2021-11-19 to 2022-11-03 and a CAGR of 17.39%. IWM had volatility of 22.35%, a maximum drawdown of 31.92% and a CAGR of 8.03%. TLT had volatility of 15.33%, a maximum drawdown of 44.06% that had not recovered by the end of the data and a CAGR of -8.64%.
TQQQ and UVXY sit in a different range. TQQQ had volatility of 67.11%, a maximum drawdown of 81.68% from 2021-11-19 to 2022-12-28, recovered on 2024-12-04, and a CAGR of 26.86%. Its average up day was 3.01% and its average down day was -3.22%. UVXY had volatility of 103.95%, a total return of -99.94% and a CAGR of -72.83%. On a fund that moves 3% on a typical day and has an average overnight gap of 1.78%, the difference between filling at the close and filling at the next open is large in dollar terms. In dollar terms, the same $10,000 order sits further from the previous close on TQQQ than on SPY, whose average gap is 0.44%. The figures make the point that a MOC order is worth the effort in proportion to the gap. For a fund with a small gap and a deep auction the choice between the close and the open is a matter of cents. For a leveraged fund it is a matter of dollars on each trade.
The opposite side of this is risk. A MOC order commits to a fill at a price that nobody knows yet. On a fund like TQQQ, with a worst monthly loss of 36.68% in the buy-and-hold record, a closing print can differ from the last visible quote by an amount that would matter. The order guarantees the fill and gives up the price.
How the template rules relate to the close
The DeployQuant library tests 12 rule templates, each on 59 funds. The rules decide on closing data and trade at the next open or at a fixed time of day. Their trading frequency determines how much the close-versus-open choice could matter.
The RSI(2) snapback has a median of 166 round trips per fund, the highest of the 12, with a median CAGR of 4.74%, a median maximum drawdown of 17.47% and a result better than buy-and-hold on 34 of 59 funds. The weekly 7% target has a median of 106 round trips, a median CAGR of 6.61% and a median maximum drawdown of 26.26%, and it beat holding on 34 funds. The monthly cycle has a median of 69 round trips and a median CAGR of 5.46% with a drawdown of 36.63%, and it beat holding on 14.
The slower rules trade rarely. The golden cross has a median of 3 round trips, a median CAGR of 2.05% and a median drawdown of 21.84%. The trend and trailing stop has a median of 4 round trips and a median CAGR of 2.61% with a 31.15% drawdown. The dip buyer has a median of 2 round trips and a median CAGR of 1.33%. The momentum breakout has a median CAGR of 0%, and so does the 3-month momentum switch.
Between them sit the SMA 10/50 trend with a median of 17 round trips, the EMA 12/26 trend with 22, the 200-day regime filter with 18 and the RSI mean reversion with 15. Their medians are 2.12%, 2.76%, 1.84% and 2.98%.
A rule that makes 166 round trips per fund meets the open or close choice hundreds of times, and every fill carries the gap and the auction question. A rule that makes 3 meets it a handful of times. This is why execution timing is discussed mostly for high-turnover rules. For a golden cross, a difference of a few tenths of a percent at three entries does not move a result built over years. For the RSI(2) snapback, each trade is short and earns a small amount, and a persistent difference in fill price changes the result.
What these figures do not show
The data on this page describes six funds over one window and does not simulate a MOC order. Three limits apply.
First, the backtests behind the library fill on minute bars and charge no fees or slippage in the headline run. A MOC fill at the official close has not been modelled, so there is no measured comparison between closing-auction fills and open fills for any template.
Second, the overnight and intraday splits come from one stretch of 5.74 years. For SPY the overnight share was 62.46%, and for IWM it was 165.24% with a negative intraday leg. A different window could split the other way, and the signs for TLT and IWM show how unevenly the legs can fall.
Third, a closing-auction fill depends on the broker. The definition states that brokers require submission minutes before the close and that platforms emulate the order where it is not native. The cutoff and the emulation both vary, so any strategy that depends on a close fill needs to be checked against the broker's own rules and tested in paper trading first. DeployQuant paper trading runs on the live market data feed and needs no broker, which makes it a place to watch how a strategy behaves around the close before real money is involved.
Nothing here is investment advice. Backtests are hypothetical, and live trading can lose money.
Frequently asked questions
What is a MOC order?
A market-on-close order is a market order that executes in the closing auction at the official closing price. It has no limit price, so it fills at the close with no promise about the price relative to the last quote. Brokers require it to be submitted minutes before the close.
What is the difference between a MOC order and a market order?
A market order executes immediately at the best available price. A MOC order waits for the closing auction and fills at the single official closing price. The first gives up price certainty for speed, and the second gives up timing for the closing print.
Why do daily-bar strategies use MOC orders?
Their indicators are computed from closing prices, and the close is the deepest liquidity point of the session. A MOC order allows a program to trade at the same price the signal was computed from. The alternative is to decide after the close and trade the next open, which is how the DeployQuant templates are written.
How big is the gap between the close and the next open?
The average overnight gap was 0.44% for SPY, 0.59% for QQQ, 0.54% for TLT, 0.61% for IWM, 1.78% for TQQQ and 2.53% for UVXY over 2021-01-04 to 2026-10-02. The gap is larger on leveraged and volatility funds than on broad index funds.
How much of a fund's return comes overnight?
For SPY the overnight share of the log return was 62.46% and the intraday share 37.54%. For QQQ it was 64.64% and 35.36%, and for TQQQ 74.87% and 25.13%. IWM's overnight leg was 165.24% of the total because its intraday leg was negative.
What if my broker does not support MOC orders?
The definition notes that platforms emulate it with a near-close market order. The emulation fills at a price close to the official close on a liquid fund and can drift on a thin one. Check the broker's own documentation for the order types it accepts.
Does DeployQuant backtest MOC fills?
The library backtests fill on minute bars with no fees or slippage in the headline run, and most templates act at the open. MOC fills at the official close are not modelled on these pages.
Build it from blocks (or type it in English), backtest it on 5.7 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.
Related terms
Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-10-02, $10,000 starting capital, no margin, no fees or slippage in the headline run; buy-and-hold puts 98% of the account in at the first open, as the templates do) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.