Free trial
Menu
Strategy guide

Automated Swing & Delivery Stock Trading Engine

Swing trading holds positions for a few days to a few weeks, aiming to capture one leg of a larger move. It sits between intraday trading and long-term investing: positions avoid the noise of minute-by-minute charts but are not held for years. A rule-based swing strategy on NSE stocks defines the setups, entries, stops and exits exactly, so it can be tested and automated.

QuantPower Research · Updated 6 Nov 2026 · 5 min read

This guide covers the main swing setups, a complete rule set, a worked example, the risks of holding overnight, position sizing, and how to automate and test a swing strategy.

At a glance

Positional swing trading
Holding periodA few days to a few weeks
InstrumentsLiquid NSE stocks; index and stock futures
TimeframeDaily candles, sometimes hourly for entries
SetupsPullbacks in uptrends, breakouts, mean reversion
StopsBelow swing lows or a multiple of ATR
Main riskOvernight and weekend gaps

Common swing setups

Pullback in an uptrend

Buy a stock that is in a clear uptrend after a short pullback, expecting the trend to resume. For example, the stock is above its rising 50-day average and pulls back to near the 20-day average.

Breakout from a base

Buy a stock that breaks out of a multi-week range on strong volume. See the momentum breakout strategy.

Short-term mean reversion

Buy a stock in a long-term uptrend after a sharp, short drop, such as when its 2-period RSI is very low. See the RSI mean reversion strategy.

A complete rule set: pullback swing

  1. Universe: stocks in the Nifty 200 with average daily traded value above a minimum.
  2. Trend filter: the close is above the 200-day average, and the 50-day average is rising.
  3. Setup: the stock pulls back for at least three days to within 2% of its 20-day EMA.
  4. Trigger: a daily close above the previous day's high.
  5. Entry: buy at the next open.
  6. Stop: below the pullback's low, or 2 times the 14-day ATR below entry, whichever is closer.
  7. Exits: take half at 2 times the risk, then trail the stop under the 10-day EMA for the rest; exit everything after 20 trading days if neither has happened.
  8. Portfolio limits: at most eight open positions, and no more than three in one sector.

A worked example

This is a hypothetical example, not a result.

  • A stock is above its rising 50-day and 200-day averages. It pulls back for four days from ₹1,180 to ₹1,128, near its 20-day EMA of ₹1,122.
  • The next day it closes at ₹1,141, above the previous day's high of ₹1,136.
  • The algo buys 80 shares at the next open, ₹1,143. The stop is below the pullback low of ₹1,118, a risk of 80 × ₹25 = ₹2,000.
  • The first target is 2 times the risk, ₹1,193. The stock reaches it seven days later; the algo sells 40 shares for a gain of ₹2,000.
  • The stop on the remaining 40 shares trails the 10-day EMA. Two weeks later the stock closes below it at ₹1,236, and the algo sells at the next open, ₹1,232, for a further gain of 40 × ₹89 = ₹3,560.

Total gain before costs: ₹5,560 on a planned risk of ₹2,000.

Pullback swing rules: buy ₹1,143 after a pullback to the 20-day EMA, stop ₹1,118, half sold at ₹1,193, the rest trailed under the 10-day EMA (illustration)

The risks of holding overnight

Swing trades are exposed to everything that happens while the market is closed:

  • Gaps on results or news can open far beyond a stop.
  • Global moves can gap the whole market.
  • Weekends and holidays add longer stretches of unhedged risk.

Ways to manage this: avoid holding through a company's results date, keep position sizes small enough that a gap of several ATRs is survivable, and limit total exposure to one sector.

Delivery, margin and costs

Swing positions in stocks are usually bought for delivery, paying the full value, or with margin trading facilities offered by brokers, which add interest costs. Futures need margin and carry the full value's exposure, and expire monthly, so positions must be rolled. Include all of these in your costs, along with charges and taxes. Gains on shares held for less than a year are taxed as short-term capital gains; see our guide to F&O and trading taxation and confirm your position with a tax professional.

Position sizing

Size each trade by the distance to the stop, so a stopped trade loses a fixed small share of capital, such as 0.5% to 1%. With ₹10 lakh of capital and a 1% risk limit, the example above could risk up to ₹10,000; at ₹25 per share, that allows up to 400 shares. The position size calculator does this sum for you.

Automating a swing strategy

Swing strategies are slower than intraday ones, but they still benefit from automation: scanning many stocks every evening, placing entries at the open, and managing trailing stops and time exits consistently. QuantPower's strategy builder lets you set indicator and price conditions, stops, targets and exits, and deploy the strategy as a bot on your broker account. Test it in the backtesting engine and paper trading first.

Start your free trial

Connect your broker, build a strategy and test it on paper before a single live order goes out.

Backtesting tips

  • Avoid survivorship bias by testing on the stocks that were in your universe at the time.
  • Adjust prices for splits, bonuses and dividends.
  • Use the real open for entries, so gaps are included.
  • Model portfolio limits, such as the maximum number of positions, because they change which trades are taken.

See how to backtest trading strategies.

Frequently asked questions

How long is a swing trade held?

Usually a few days to a few weeks, depending on the setup and exit rules.

Is swing trading better than intraday trading?

Neither is better in general. Swing trading has larger moves and lower costs relative to the target, but carries overnight gap risk. Intraday trading avoids gaps but has smaller targets and more trades.

Which stocks are best for swing trading?

Liquid stocks with enough daily traded value to enter and exit without much slippage, typically large and mid-cap stocks.

Can I swing trade with futures?

Yes, but futures carry leverage and expire monthly, so positions must be rolled and margin managed.

Sources

  • Murphy, J. J. (1999). Technical Analysis of the Financial Markets. New York Institute of Finance
  • Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research (Average True Range)
The example on this page is hypothetical and for illustration. Trading involves substantial risk. This guide is for education and is not investment advice.