PROTECTED SOURCE SCRIPT
Live Repainting Swing Strategy (Trendlines + EMA)

🔍 How It Works
Swing High/Low Detection (Repainting):
Detects unconfirmed, live swing highs and lows using a user-defined lookback length. These pivots repaint, updating as the chart evolves — just like a discretionary trader would.
Buy Entry:
New swing low appears
No recent signal in the last X bars (cooldown)
Entry is placed at the swing low
Sell Entry:
New swing high appears
Cooldown condition met
Entry is placed at the swing high
Exit Logic:
Configurable Take Profit and Stop Loss percentages
A marker is plotted when TP is hit (green for longs, orange for shorts)
✳️ Visual Elements
Marker Meaning
🔺 Green Buy signal at swing low
🔻 Red Sell signal at swing high
🟢 Lime Circle TP hit on a long
🟠 Orange Circle TP hit on a short
🔶 EMA Line Trend context (default: 50 EMA)
📏 Trendlines Repainting lines from last swing high/low to current price
⚙️ Configurable Inputs
Swing Length: Sensitivity of pivot detection
Cooldown: Min bars between signals to prevent overtrading
SL % and TP %: Risk-reward settings
EMA Length: Dynamic trend filter overlay
🚦 Designed For
5-minute to 1-hour charts
Price action traders
Real-time analysis and visual confirmation
Use with alerts or manual scalping
Swing High/Low Detection (Repainting):
Detects unconfirmed, live swing highs and lows using a user-defined lookback length. These pivots repaint, updating as the chart evolves — just like a discretionary trader would.
Buy Entry:
New swing low appears
No recent signal in the last X bars (cooldown)
Entry is placed at the swing low
Sell Entry:
New swing high appears
Cooldown condition met
Entry is placed at the swing high
Exit Logic:
Configurable Take Profit and Stop Loss percentages
A marker is plotted when TP is hit (green for longs, orange for shorts)
✳️ Visual Elements
Marker Meaning
🔺 Green Buy signal at swing low
🔻 Red Sell signal at swing high
🟢 Lime Circle TP hit on a long
🟠 Orange Circle TP hit on a short
🔶 EMA Line Trend context (default: 50 EMA)
📏 Trendlines Repainting lines from last swing high/low to current price
⚙️ Configurable Inputs
Swing Length: Sensitivity of pivot detection
Cooldown: Min bars between signals to prevent overtrading
SL % and TP %: Risk-reward settings
EMA Length: Dynamic trend filter overlay
🚦 Designed For
5-minute to 1-hour charts
Price action traders
Real-time analysis and visual confirmation
Use with alerts or manual scalping
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
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 dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
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.