OPEN-SOURCE SCRIPT
Enhanced Swing + Intraday Strategy + Entry/Exit Labels

Purpose
This TradingView Pine Script is designed for swing traders who hold trades for 3–5 days, but also occasionally do intraday trading. It combines momentum indicators, moving averages, and support/resistance tools to give a complete picture of trend direction, entries, and exits.
Features and Logic Breakdown
1. 20-Day Simple Moving Average (Daily Timeframe)
Fixed to the daily chart, regardless of your active chart timeframe.
Acts as a trend filter and price magnet, especially useful for mean reversion setups.
Helps assess whether the stock is overbought/oversold relative to its 1-month average.
2. VWAP (Volume-Weighted Average Price)
Useful for intraday trades.
Acts as an intraday "fair value" and gravity zone.
Helps identify entries near institutional support/resistance.
3. 9-EMA and 20-EMA (Current Timeframe)
Short-term trend signals.
When 9 EMA crosses above 20 EMA → bullish entry.
When 9 EMA crosses below 20 EMA → bearish exit.
4. Entry/Exit Labels
Plots "Enter" label (green) when 9 EMA crosses above 20 EMA.
Plots "Exit" label (red) when 9 EMA crosses below 20 EMA.
Helps visually track signals without guesswork.
5. Alerts
Built-in conditions to trigger alerts for:
Bullish cross (9 EMA above 20 EMA)
Bearish cross (9 EMA below 20 EMA)
6. Bollinger Bands (20-period, 2 Std Dev)
Shows volatility expansion/contraction around the 20-period SMA.
Can help identify overextended prices or squeeze setups.
Plotted as gray upper/lower bands with shading.
7. MACD (12/26/9) – Hidden
Measures momentum and trend strength.
Lines and histogram are hidden by default but can be toggled on in settings.
8. RSI (14) – Hidden
Measures overbought/oversold conditions.
Hidden by default but plotted between 0–100 with 30/70 lines.
How to Use
On Daily Charts:
Use the script for core swing entries. Enter long on 9 EMA > 20 EMA when price is near the 20-day SMA. Confirm with RSI/MACD if needed.
On Intraday Charts:
Use VWAP and EMAs to manage exits or find sharp intraday pullbacks.
The 20-day SMA still acts as an anchor.
Recommended Trade Flow
1. Identify price trend: Is it above or below the 20-day SMA?
2. Wait for EMA cross entry signal ("Enter" label).
3. Check if RSI is in neutral (not overbought) and MACD histogram is rising.
4. Manage trade using VWAP and 20-day SMA as guide.
5. Exit when "Exit" label triggers or price extends from VWAP.
This TradingView Pine Script is designed for swing traders who hold trades for 3–5 days, but also occasionally do intraday trading. It combines momentum indicators, moving averages, and support/resistance tools to give a complete picture of trend direction, entries, and exits.
Features and Logic Breakdown
1. 20-Day Simple Moving Average (Daily Timeframe)
Fixed to the daily chart, regardless of your active chart timeframe.
Acts as a trend filter and price magnet, especially useful for mean reversion setups.
Helps assess whether the stock is overbought/oversold relative to its 1-month average.
2. VWAP (Volume-Weighted Average Price)
Useful for intraday trades.
Acts as an intraday "fair value" and gravity zone.
Helps identify entries near institutional support/resistance.
3. 9-EMA and 20-EMA (Current Timeframe)
Short-term trend signals.
When 9 EMA crosses above 20 EMA → bullish entry.
When 9 EMA crosses below 20 EMA → bearish exit.
4. Entry/Exit Labels
Plots "Enter" label (green) when 9 EMA crosses above 20 EMA.
Plots "Exit" label (red) when 9 EMA crosses below 20 EMA.
Helps visually track signals without guesswork.
5. Alerts
Built-in conditions to trigger alerts for:
Bullish cross (9 EMA above 20 EMA)
Bearish cross (9 EMA below 20 EMA)
6. Bollinger Bands (20-period, 2 Std Dev)
Shows volatility expansion/contraction around the 20-period SMA.
Can help identify overextended prices or squeeze setups.
Plotted as gray upper/lower bands with shading.
7. MACD (12/26/9) – Hidden
Measures momentum and trend strength.
Lines and histogram are hidden by default but can be toggled on in settings.
8. RSI (14) – Hidden
Measures overbought/oversold conditions.
Hidden by default but plotted between 0–100 with 30/70 lines.
How to Use
On Daily Charts:
Use the script for core swing entries. Enter long on 9 EMA > 20 EMA when price is near the 20-day SMA. Confirm with RSI/MACD if needed.
On Intraday Charts:
Use VWAP and EMAs to manage exits or find sharp intraday pullbacks.
The 20-day SMA still acts as an anchor.
Recommended Trade Flow
1. Identify price trend: Is it above or below the 20-day SMA?
2. Wait for EMA cross entry signal ("Enter" label).
3. Check if RSI is in neutral (not overbought) and MACD histogram is rising.
4. Manage trade using VWAP and 20-day SMA as guide.
5. Exit when "Exit" label triggers or price extends from VWAP.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.