I Tested the “Buy at Close, Sell at Open” Trading Strategy — Does It Actually Work?

I Tested the “Buy at Close, Sell at Open” Trading Strategy — Does It Actually Work?

The buy at close, sell at open strategy is one of the simplest trading ideas you will ever hear: buy a stock near the end of the trading day, hold it overnight, and sell it shortly after the market opens. But does this overnight trading strategy actually work? I tested the strategy using real market data to see how it performed, where the returns came from, how frequently it won, and whether the results were strong enough to make it a realistic trading approach. A large portion of the stock market’s historical gains have occurred outside normal trading hours. That has led some investors and traders to believe that buying at the market close and selling at the next market open could outperform simply holding during the trading day. The idea sounds straightforward, but there are several factors that can affect the results: Overnight price gaps Earnings announcements Economic reports Market-moving news Bid-ask spreads Slippage Trading fees Taxes Position sizing Risk management I walk through how the strategy works, the assumptions behind it, the results of the test, and the practical risks that may not appear in a basic backtest. We also look at the difference between overnight returns and intraday returns, why stocks frequently move when the market is closed, and whether this strategy could realistically be used by a retail trader. This is not a guaranteed-profit strategy. A backtest can show how an idea performed historically, but it cannot guarantee that the same results will continue in the future. Real-world execution, market conditions, liquidity, taxes, and trading costs can significantly change the outcome. The goal is to determine whether “buy at close and sell at open” is a legitimate market anomaly, a useful trading system, or simply another strategy that looks better on paper than it performs in reality. Subscribe to Sacco Financial for more stock market research, trading strategy tests, market analysis, investing education, and technology stock coverage. =====SCRIPT==== import pandas as pd import yfinance as yf ticker = "QQQ" start_date = "2023-01-01" end_date = None starting_capital = 1.00 data = yf.download(ticker, start=start_date, end=end_date, auto_adjust=False) yfinance returns MultiIndex columns for single-ticker downloads if isinstance(data.columns, pd.MultiIndex): data.columns = data.columns.get_level_values(0) data = data.dropna() Strategy returns data["overnight_return"] = data["Open"].shift(-1) / data["Close"] - 1 data["intraday_return"] = data["Close"] / data["Open"] - 1 data["buy_hold_return"] = data["Close"].pct_change() Drop last row because tomorrow's open is unknown data = data.dropna() Equity curves data["overnight_equity"] = starting_capital * (1 + data["overnight_return"]).cumprod() data["intraday_equity"] = starting_capital * (1 + data["intraday_return"]).cumprod() data["buy_hold_equity"] = starting_capital * (1 + data["buy_hold_return"]).cumprod() def stats(name, returns, equity): total_return = equity.iloc[-1] / equity.iloc[0] - 1 years = len(returns) / 252 cagr = (equity.iloc[-1] / equity.iloc[0]) ** (1 / years) - 1 win_rate = returns.gt(0).mean() avg_return = returns.mean() max_drawdown = (equity / equity.cummax() - 1).min() print(f"\n{name}") print("-" * 30) print(f"Final $1 Value: ${equity.iloc[-1]:.2f}") print(f"Total Return: {total_return:.2%}") print(f"CAGR: {cagr:.2%}") print(f"Win Rate: {win_rate:.2%}") print(f"Average Trade Return: {avg_return:.4%}") print(f"Max Drawdown: {max_drawdown:.2%}") stats("Overnight: Buy Close / Sell Next Open", data["overnight_return"], data["overnight_equity"]) stats("Intraday: Buy Open / Sell Close", data["intraday_return"], data["intraday_equity"]) stats("Buy & Hold", data["buy_hold_return"], data["buy_hold_equity"]) ==== END SCRIPT==== Topics covered: Buy at close sell at open strategy Overnight trading strategy Stock market backtesting Overnight stock returns Intraday trading returns Trading strategy results Market close trading Market open trading Swing trading strategies Day trading strategies Stock market anomalies Algorithmic trading strategies Quantitative trading Trading risk management Stock market investing #StockMarket #Trading #Investing #TradingStrategy #StockTrading #DayTrading #SwingTrading #OvernightTrading #Backtesting #TechnicalAnalysis #MarketAnalysis #Stocks #InvestingForBeginners #TradingForBeginners #QuantTrading #AlgorithmicTrading #FinancialEducation #PersonalFinance #MarketOpen #MarketClose #StockMarketStrategy #RiskManagement #WallStreet #Finance #SaccoFinancial