Stock trading strategies: compare the rules before the returns

Stock trading strategies define which shares to trade, what triggers an entry, how a position ends, and how much capital it can use. Trend continuation, pullbacks, and opening gaps test different price behavior. A useful comparison keeps the stock universe, data treatment, costs, and execution assumptions visible alongside the results.

Draft stock strategy rules

Key Takeaways

  • Specify the stock universe and holding period before choosing indicators.
  • Split adjustments, dividends, and session settings can change signals and the meaning of a return.
  • Testing only stocks that survive today can omit the companies that would have lost money or disappeared from the original universe.
  • Use a common baseline to compare stocks, then test justified variations on separate data. Neither universal settings nor a separate optimized winner for every stock establish performance on unseen data.

Compare trend, pullback, and opening-gap rules

These illustrative long-only specifications are research hypotheses, not proven profitable systems. The numbers define a starting experiment. Use standard candles, one position per stock, no additions, and a declared exposure cap. Daily rules allow overnight positions; the gap rule is intraday. Compare their capital use and exposure as well as returns.

Illustrative stock strategy rules and their failure conditions
SetupEntry decisionExit ruleWhat can fail
Trend continuationOn a daily close, price exceeds the highest high of the previous 20 completed sessions and its 50-day SMA.Initial stop at signal close minus 2 times the signal-day 14-day ATR; exit after a close below the 20-day SMA or 20 holding bars.A breakout fails or repeated sideways moves trigger losses. An overnight gap can cross the stop.
Trend pullbackOn a daily close above the 50-day SMA, the low touched the 20-day SMA and the close recovered above it. The 50-day SMA exceeds its value five sessions earlier.Stop one minimum tick below the signal low; exit after a close above the signal high plus 2 times the signal-day 14-day ATR, or 10 holding bars.A pullback develops into a reversal. A large next-session opening move changes the entry-to-stop distance.
Opening-gap continuationRegular-session open is at least 2% above the previous regular close. The first 5-minute candle closes above its open.Stop one minimum tick below that candle low; submit a time exit after the bar ending five minutes before the regular session close.The opening move reverses, liquidity is poor, or an event causes a halt. No fill is assured at the planned session exit.

Turn each entry into an executable test

Submit entries only after the signal bar closes. TradingView normally fills a historical market order at the next available tick, often the next bar open. Keep that delay in the model instead of assigning the signal close as the fill. Freeze the example stop and price target when the signal forms. For daily rules, count the entry bar as holding bar one and submit the time exit after the stated number of completed bars. Protective stop orders and close-based exits are different instructions.

  • Declare position size before the entry, such as a fixed percentage of available equity, with whole-share rounding and a cash cap. The same allocation can still produce different stop risks across stocks.
  • If a market entry fills below its planned stop or beyond its planned target, flag the invalid setup and close at the next available opportunity. Keep that trade and its costs in the record.
  • For the gap rule, calculate 100 × (regular-session open / previous regular-session close − 1). Use the exchange calendar, including early closes, for the exit deadline.
  • Use only information available at the decision time. A morning signal cannot use that session's final high, low, or total volume.
  • Record commissions, slippage, spread assumptions, cash limits, and event exclusions. Treat short selling as a separate test with borrow availability and costs.

Check stock splits and dividends before interpreting a signal

TradingView recalculates historical chart prices for stock splits. A hypothetical 2-for-1 split turns one $100 share into two $50 shares without itself halving the holding value. An unadjusted discontinuity should not become a momentum or gap signal. Record the adjustment convention and verify corporate-action dates when a signal looks unusual.

  • TradingView offers dividend-adjusted charts for supported assets. The adjusted series represents dividend-inclusive performance and can differ from a price-only series.
  • For an opening-gap experiment, declare whether the gap measures the quoted price change or an adjusted change. Review ex-dividend dates separately; a distribution-related price change is a different event from a news-driven move.
  • Do not mix an adjusted signal series with unadjusted stop prices or share counts without an explicit conversion.
  • Distinguish chart adjustment from account bookkeeping. Document whether the test credits cash dividends and how it handles shares held across a split; do not count a dividend twice.
  • Use the same price-return or total-return basis for the strategy and benchmark. Preserve the chart settings with the exported results.

Separate regular hours from premarket and after-hours data

A gap from the previous regular close to the next regular open differs from a gap between adjacent extended-hours bars. TradingView allows regular and extended named sessions where the instrument and account support them. State which session supplies the moving average, prior close, signal bars, and order eligibility. Changing only the chart display can otherwise change the experiment.

  • For the illustrative gap strategy, use regular-session bars for both reference prices and entries. Premarket activity can be a separate filter only if its data is available at the signal time.
  • Use the exchange timezone and calendar rather than fixed UTC hours; daylight-saving changes and shortened sessions matter.
  • FINRA identifies lower liquidity, wider spreads, volatility, and execution uncertainty as extended-hours risks. Test separate cost assumptions if orders are allowed outside regular hours.
  • A session filter does not guarantee an end-of-day fill. Model an exit deadline, then inspect holidays, missing bars, halts, and orders left open.

Keep the historical stock universe intact

A test on today's index members answers how those selected stocks behaved in the past. It does not recreate the index membership available to a trader at each historical date. Survivorship bias appears when failed, delisted, or acquired companies are omitted. Shumway's original research also documents how missing negative delisting returns can distort a stock-return database. Including a ticker name alone does not establish complete return history.

  • Build the universe from membership and eligibility information known at each date. Keep failed and delisted stocks where reliable data is available.
  • Record listing dates, symbol changes, mergers, missing bars, and terminal returns. Do not silently replace missing returns with zero.
  • Use historical liquidity and price filters rather than today's market capitalization to select past trades.
  • If point-in-time membership or delisting data is unavailable, label the test as a selected-stock study. More parameter searches cannot repair that data limitation.

Compare stocks and sample periods without fitting every winner

A stock trading strategy can behave differently across volatile growth shares, less volatile shares, and thinly traded shares. Start with identical rules to see those differences, but do not assume one lookback, dollar stop, or gap threshold suits every stock. Percentage or volatility-based distances make scales more comparable; they do not remove liquidity and event risk.

  • Declare the baseline parameters and candidate alternatives before testing. If settings vary by liquidity or volatility, define the grouping with information available at the time.
  • Separate development dates from untouched evaluation dates, and reserve additional stocks for evaluation when data permits. Keep unsuccessful variants in the experiment log.
  • Report each symbol and period: trade count, net return after costs, drawdown, exposure, and turnover. Include a matched benchmark and show results that contradict the hypothesis.
  • Inspect nearby parameter values and higher-cost scenarios. A narrow isolated optimum is a reason to investigate, not evidence of a durable advantage.
  • Do not add independent single-stock backtest returns and label the sum a portfolio result. Simultaneous positions need shared cash, position limits, and correlated-loss accounting.

Draft and inspect the strategy with Pineify

Pine Script AI Coding Agent can draft editable strategy code from the rules. Include the stock session, adjustment assumptions, signal timing, sizing, exits, and test dates in the request. Review the code against that specification. Strategy Optimizer compares supported input combinations in TradingView and exports results. Run and label separate symbol and date-range tests; choosing a high historical result is not independent validation. Backtest Deep Report analyzes compatible TradingView List of Trades CSV files, including trade and drawdown metrics. Preserve a separate file and settings record for each run. These tools do not supply missing historical constituents, fix survivorship bias, or establish a combined portfolio result.

Pineify next step

Turn the stock rules into a strategy you can inspect

Specify the universe, session, entry timing, sizing, and exits. Draft the Pine Script, then review separate symbol and period tests before comparing results.

This page is educational and does not provide investment advice. The example rules and parameters are hypothetical and have no claimed performance. Stock trading can lose money, including through gaps, halts, and unavailable liquidity. Historical simulations do not guarantee future results.

Frequently Asked Questions