OPEN-SOURCE SCRIPT

Swing Trade System

73
# Swing Trade Strategy - Complete Guide

## Overview

This is a comprehensive swing trading indicator for TradingView that identifies high-probability trend continuation setups using multi-timeframe analysis, pullback patterns, and momentum confirmation. The strategy combines technical indicators with risk management tools to help traders capture swing moves with defined risk-reward parameters.

## What It Does

The indicator identifies two types of signals:

1. **Base Signals** (small markers) - Initial setup detection with basic criteria met
2. **High Confidence (HC) Signals** (large markers) - Fully confirmed setups with all filters passed, including optional higher timeframe confirmation

Once a HC signal triggers, the indicator automatically plots:
- Dynamic stop loss levels (trailing, break-even, or static)
- Partial take profit (TP1) at 1R
- Final take profit (TP2) at your chosen risk-reward multiple
- Real-time R-multiple tracking
- Confluence dashboard showing all conditions

## How It Works

### Core Signal Logic

The strategy identifies pullback-to-trend entries using this sequence:

**For LONG signals:**
1. **Trend Filter**: Fast EMA (20) above Slow EMA (50) = uptrend confirmed
2. **Pullback**: Previous candle closed between the two EMAs (pulled back but didn't break structure)
3. **RSI Swing Zone**: RSI between 40-60 (not overbought/oversold, just resting)
4. **Reclaim**: Current candle crosses back above Fast EMA (momentum returning)
5. **Volume Spike** (optional): Current volume > 1.5x the 20-period average
6. **HTF Confirmation** (optional): Daily timeframe shows: price > 50 EMA, RSI > 50, and rising momentum

**For SHORT signals:**

The same logic applies in reverse (downtrend, pullback above fast EMA, reclaim below, etc.)

### Risk Management Features

**Stop Loss Placement:**
- Initial stop: Swing low/high over the last 10 bars
- Can upgrade to ATR trailing stop (2x ATR below/above price)
- Can move to break-even after reaching 1R profit

**Take Profit Levels:**
- TP1: 1R (optional partial exit point)
- TP2: 2R default (adjustable to your preference)

**Position Monitoring:**
- Live R-multiple display shows current profit/loss in risk units
- Dynamic stop updates visually on chart
- Color-coded confidence score (0-100%) based on confluence of factors

## Best Way to Use These Signals

### 1. **Wait for High Confidence Signals Only**

- Don't trade every base signal (small markers)
- Only take trades when you see the large "HC L" or "HC S" markers
- These have passed all your filters including higher timeframe alignment

### 2. **Ideal Entry Timing**

**On the Signal Candle:**
- Enter at market close when HC signal fires
- This ensures all conditions were met by candle close
- Your stop and targets are calculated from this close price

**On the Next Candle (more conservative):**
- Wait for the candle after the signal
- Enter if price continues in the signal direction
- Helps avoid false breakouts but may miss some moves

### 3. **Position Sizing**

Use the automatic risk calculation:
- Your risk = Entry price - Stop loss
- Position size = (Account Risk %) ÷ (Entry - Stop)
- Example: Risk $100 on account, Entry $50, Stop $48 = $100 ÷ $2 = 50 shares

### 4. **Trade Management**

**Scaling Out:**
- Exit 50% position at TP1 (1R) to lock profits
- Move stop to break-even on remaining position
- Let rest run to TP2 (2R) or trail with ATR stop

**Manual Override:**
- If price action deteriorates (breaks below both EMAs, RSI divergence), consider early exit
- The dynamic stop is a guide, not gospel—trust price action

## Breakout vs. Retest Strategy


### Understanding Breakout Types

**1. First Touch Breakout (Aggressive)**
- HC signal fires on first touch of fast EMA after pullback
- Higher win rate if volume is strong
- Best in strongly trending markets
- Risk: Could be a false breakout if momentum weak

**2. Retest Entry (Conservative)**
- Wait for price to pull back *again* after initial HC signal
- Enter when price retests the fast EMA a second time
- Look for: lower volume on retest, RSI still in swing zone, fast EMA still above slow EMA
- Lower risk but may miss some fast moves

### Which Breakouts to Take

**Take the FIRST breakout (signal candle) when:**
- ✅ Higher timeframe is strongly aligned (HTF confirmation on)
- ✅ Volume spike is present (>1.5x average)
- ✅ Confidence score ≥70%
- ✅ Trend is fresh (EMAs recently crossed, not extended)
- ✅ Price closed strongly above/below fast EMA (not barely crossed)
- ✅ No major resistance/support nearby

**Wait for a RETEST when:**
- ⚠️ No volume confirmation on first signal
- ⚠️ Confidence score 40-69% (moderate)
- ⚠️ Price barely crossed the fast EMA (weak momentum)
- ⚠️ Trend is extended (price far from slow EMA)
- ⚠️ Major resistance/support level just ahead
- ⚠️ Late in the trading day/week (could see pullback)

### How to Trade Retests

**Setup:**
1. HC signal fires but you decide to wait
2. Price pulls back toward fast EMA over next 1-3 candles
3. Watch for second bounce at the fast EMA

**Confirmation for Retest Entry:**
- Price holds above fast EMA (for longs) without closing below it
- Volume decreases on the pullback (profit-taking, not reversal)
- RSI stays above 50 for longs (or below 50 for shorts)
- Bullish candlestick pattern forms (hammer, engulfing, etc.)
- Slow EMA is still providing support/resistance

**Retest Entry Trigger:**
- Enter when price crosses back in signal direction with momentum
- Or enter with a limit order at the fast EMA
- Use same stop loss as original signal (swing low/high)
- Targets remain the same (measured from your new entry)

## Dashboard Reference

The top confluence table shows real-time status:

- **Trend**: Current trend direction based on EMAs
- **HTF**: Higher timeframe alignment (if enabled)
- **RSI Zone**: Whether RSI is in the 40-60 swing zone
- **Volume**: Volume spike present or not
- **Signal**: Current signal status (HC LONG/SHORT or None)
- **R Risk**: Current profit/loss in R-multiples
- **Stop**: Current stop loss price
- **TP1/TP2**: Status of take profit levels
- **Conf %**: Overall confidence score (70%+ = high probability)

## Alert Setup

The indicator includes 8 alert types:

1. **HC LONG/SHORT ENTRY** - Main trade signals
2. **LONG/SHORT TP1 Reached** - Partial profit alerts
3. **LONG/SHORT Final TP Reached** - Full target hit
4. **LONG/SHORT Stop Hit** - Exit alerts

Set up alerts in TradingView:
- Click "Create Alert" on the indicator
- Choose the specific alert condition
- Set to "Once Per Bar Close" to avoid false alerts
- Configure notification method (app, email, webhook, etc.)

## Recommended Settings


**For Stock Swing Trading (4H-Daily):**
- Fast EMA: 20 | Slow EMA: 50
- Swing Lookback: 10
- RSI Zone: 40-60
- HTF: Daily (if trading 4H charts)
- Risk-Reward: 2R minimum

**For Crypto (faster moves):**
- Fast EMA: 12 | Slow EMA: 26
- Swing Lookback: 7
- RSI Zone: 35-65
- Volume Spike: ON
- Risk-Reward: 1.5-2R

**For Conservative Trading:**
- Enable HTF Confirmation
- Enable Volume Spike requirement
- Use Break-even stop (move after 1R)
- Only trade when Confidence ≥70%
- Wait for retests on marginal setups

## Risk Warning

This indicator is a tool, not a guarantee. Always:
- Use proper position sizing (risk 1-2% per trade)
- Respect the stop losses
- Consider market context (news, earnings, major levels)
- Backtest on your instruments before live trading
- Never override risk management for FOMO

The best signals combine technical confluence with good market conditions and disciplined execution.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.