Introduction
Swing trading is all about capturing short- to medium-term price movements in stocks. The key to success? Spotting opportunities where the risk-to-reward ratio is favorable. One of the most effective patterns traders look for is consolidation followed by breakout. This article introduces a powerful Long-Only Swing Trading Strategy that leverages the compression of multiple moving averages to identify high-probability breakout trades.
Let’s call this strategy The Pressure Cooker Strategy.
Strategy Overview
- Type: Swing Trading
- Direction: Long-only
- Segment: Cash Market (No derivatives)
- Stock Universe: Nifty 200 stocks
The Core Logic
This strategy is built around the principle of price consolidation. When a stock moves sideways for an extended period, it builds up potential energy. Once this energy is released in the form of a breakout, the stock tends to rally with strong momentum.
Here’s how we identify a consolidation phase:
- We track five key moving averages (5, 20, 50, 100, 200 periods).
- When these moving averages compress within a 3% range of the current price, it signals a tight consolidation.
- Such setups indicate that buyers and sellers are in equilibrium, but once the breakout occurs, the imbalance creates a strong trend.

The Screening Mechanism
To automate the stock selection, I have developed a custom Chartink screener that scans for stocks where all five moving averages are squeezed within a 3% price range. This screener helps identify stocks that are primed for an explosive move.
Link to Chartink Scanner: https://chartink.com/screener/pressurecooker
Additionally, I have created a Python utility that extracts the results from Chartink. This utility provides a list of stocks meeting the consolidation criteria, ready for further analysis and trading.

""" Fetch Chartink Scanner results from Chartink.com website using python Input: 1. Chartink scan URL 2. Scan Clause (Inspect webpage and find this under 'Network' / 'process' / 'Payload' section) -- Dependencies to be installed -- pip install requests pip install pandas pip install beautifulsoup4 Disclaimer: The information provided is for educational and informational purposes only and should not be construed as financial, investment, or legal advice. The content is based on publicly available information and personal opinions and may not be suitable for all investors. Investing involves risks, including the loss of principal. """ # Import all dependencies import requests import pandas as pd from bs4 import BeautifulSoup as bs import time def chartink_scraper(url, scan_clause): # Retrieves the results of Chartink scanner. Input is the url and the scan clause # Example of scan clause : {'scan_clause': '( {33619} ( latest close > latest sma( latest close , 200 ) # and latest close > latest sma( latest close , 100 ) and latest close > latest sma( latest close , 50 ) )'} # Scan clause can be obtained by doing an 'inspect' on the page and under 'Network' / 'process' / 'Payload' df = pd.DataFrame() try: with requests.Session() as s: r = s.get(url) soup = bs(r.text, "html.parser") csrf = soup.select_one("[name='csrf-token']")['content'] s.headers['x-csrf-token'] = csrf s.headers['Content-Type'] = 'application/x-www-form-urlencoded' r = s.post('https://chartink.com/screener/process', data=scan_clause) df = pd.DataFrame().from_dict(r.json()['data']) return df except requests.exceptions.HTTPError as e: print("Error in network connection") except requests.exceptions.RequestException as e: print("Error extracting data from website: ", e) if __name__ == "__main__": # Extract Chartink scan results into a dataframe # Sometimes extract fails temporarily due to network congestion. The loop below will try thrice before giving up try_again = 0 smart_money_stocks = [] while try_again <= 3: # If the chartink extract fails, try for a couple of times scan_clause = { 'scan_clause': '( {57960} ( ( {57960} ( latest sma( latest close , 5 ) ' '< latest close * 1.03 and latest sma( latest close , 20 ) ' '< latest close * 1.03 and latest sma( latest close , 50 ) ' '< latest close * 1.03 and latest sma( latest close , 100 ) ' '< latest close * 1.03 and latest sma( latest close , 200 ) ' '< latest close * 1.03 and latest sma( latest close , 5 ) ' '> latest close * 0.97 and latest sma( latest close , 20 ) ' '> latest close * 0.97 and latest sma( latest close , 50 ) ' '> latest close * 0.97 and latest sma( latest close , 100 ) ' '> latest close * 0.97 and latest sma( latest close , 200 ) ' '> latest close * 0.97 ) ) ) )'} url = 'https://chartink.com/screener/consolidatedbo' df = chartink_scraper(url, scan_clause) print(df) stocks_list = df['nsecode'].tolist() print(stocks_list) print("Extract Successful!") if df.empty: print("Extract failed. Going to try again...") time.sleep(10) try_again += 1 else: break
How to Use the Screener Output
Approach 1: Manual Trading (Watchlist-Based)
- Filter the top 3 stocks from the screener list based on the highest trading volume.
- Add these stocks to a watchlist.
- Wait for a clear breakout from the consolidation range on an intraday or daily chart.
- Once a confirmed breakout happens (preferably with volume expansion), enter a long position with a stop-loss below the consolidation range.
- Ride the trend until momentum slows down or a reversal signal appears.
Approach 2: Automated Trading Strategy
For traders looking for a hands-free approach, an automated Python trading bot can be developed. Here’s how it works:
- The bot runs daily to extract the latest screener results.
- Every trading day, the bot monitors these stocks every 5 minutes for breakout signals.
- When a breakout occurs, the bot automatically places long orders with a predefined stop-loss and target.
- The trade is managed with a trailing stop to maximize gains while minimizing risk.
Why This Strategy Works
- Breakouts from tight consolidations have high success rates since price expansion follows contraction.
- Multiple moving averages aligning closely act as dynamic support, reducing downside risk.
- Stock selection is limited to Nifty 200, ensuring liquidity and lower impact costs.
- Volume confirmation ensures false breakouts are avoided.
Risk Management & Trade Execution
Entry Criteria:
- A confirmed breakout above the consolidation zone.
- Strong volume supporting the breakout.
- Bullish candlestick pattern or price action confirmation.
Stop-Loss Placement:
- Just below the consolidation range.
- Alternatively, a fixed 2-3% stop can be used.
Exit Strategy:
- Trailing stop-loss: To capture extended moves (Recommended)
- Fixed target: At least 1.5x to 2x the risk.
Final Thoughts
The Pressure Cooker Strategy is an excellent tool for swing traders looking to capitalize on momentum-driven moves. Whether manually traded or fully automated, this approach offers a structured way to catch explosive breakouts with a well-defined risk-reward framework.
If you’re serious about swing trading, start by integrating this strategy into your workflow, backtest the results, and fine-tune it to match your trading style. Happy trading!
Support this community : FabTrader.in is a one-person initiative dedicated to helping individuals on their F.I.R.E. journey. Running and maintaining this community takes time, effort, and resources. If you’ve found value in the content, consider making a donation to support this mission.
Disclaimer: The information provided in this article is for educational and informational purposes only and should not be construed as financial, investment, or legal advice. The content is based on publicly available information and personal opinions and may not be suitable for all investors. Investing involves risks, including the loss of principal. Always conduct your own research and consult a qualified financial advisor before making any investment decisions. The author and website assume no liability for any financial losses or decisions made based on the information presented.