OPEN-SOURCE SCRIPT
Swing Point Hedge Strategy

🎯 Strategy Concept:
This bot trades primary trend positions and automatically hedges when key support/resistance levels break, protecting your capital from reversals.
📊 Market Structure Detection:
Uptrend Structure:
✅ Higher Highs (HH): Each swing high is higher than the previous
✅ Higher Lows (HL): Each swing low is higher than the previous
🟢 Green triangles and lines
Downtrend Structure:
✅ Lower Highs (LH): Each swing high is lower than the previous
✅ Lower Lows (LL): Each swing low is lower than the previous
🔴 Red/Orange triangles and lines
💡 Trading Logic:
Primary Positions (Trend Following):
UPTREND:
Long Entry: Price breaks above Higher High
Opens 2x position size
Follows the trend
Green triangle marker
DOWNTREND:
Short Entry: Price breaks below Lower Low
Opens 2x position size
Follows the trend
Red triangle marker
Hedge Positions (Risk Protection):
When LONG (Uptrend):
Hedge Short: If price breaks below Higher Low (HL)
Support broken = potential reversal
Opens 1x SHORT position (hedge)
Orange X marker
Up to 2 hedge positions allowed
When SHORT (Downtrend):
Hedge Long: If price breaks above Lower High (LH)
Resistance broken = potential reversal
Opens 1x LONG position (hedge)
Aqua X marker
Up to 2 hedge positions allowed
🛡️ How Hedging Works:
Example Scenario:
Bot opens LONG (2x size) on Higher High break
Price pulls back and breaks Higher Low (support)
Bot opens HEDGE SHORT (1x size) automatically
Net Position: Still LONG 1x (2 - 1 = 1)
Protection: If trend reverses, hedge minimizes loss
If trend resumes: Close hedge, keep primary position
📈 Risk Management:
Stop Loss Options:
Fixed percentage-based (2% default)
Applied to all positions
Protects capital from major moves
Take Profit:
Fixed percentage (3% default)
Locks in profits automatically
Optional toggle
Position Sizing:
Primary: 50% equity (2x with pyramiding)
Hedge: 25% equity (1x)
Max 2 hedge positions per primary
🎨 Visual Features:
Swing Point Markers:
🔼 Triangles up: Swing lows (Green = HL, Red = LL)
🔽 Triangles down: Swing highs (Green = HH, Orange = LH)
Lines: Connect swing points showing structure
Support/Resistance Zones:
Red zones: Previous swing highs (resistance)
Green zones: Previous swing lows (support)
Automatically extend to right
Entry Signals:
🟢 Large green triangle: Primary long entry
🔴 Large red triangle: Primary short entry
🟠 Orange X: Hedge short entry
🔵 Aqua X: Hedge long entry
📊 Info Table Shows:
Market Structure: Uptrend ↑ / Downtrend ↓ / Neutral
Previous High/Low: Key levels being monitored
Primary Position: Current trend position
Hedge Count: How many hedges are active
Net Position: Actual market exposure
Open P&L: Real-time profit/loss
Performance Stats: Total trades, net profit
⚙️ Settings:
Swing Detection:
Length: 5 bars (adjustable 2-20)
Smaller = more swings, more signals
Larger = major swings only
Hedge Options:
Toggle hedge on/off
Auto-close hedges on retrace
Max number of hedges (1-3)
Risk Settings:
Stop loss percentage
Take profit percentage
Toggle each independently
🎯 Use Cases:
Best For:
Volatile markets with false breaks
Protecting trending positions
Risk-averse traders
Swing trading timeframes (15m - 4H)
Strategy Benefits:
✅ Automatic risk protection
✅ Reduces drawdown
✅ Captures reversals
✅ No manual intervention needed
✅ Clear visual feedback
This is a sophisticated hedging bot that automatically protects your positions while keeping you in profitable trends! 🚀
This bot trades primary trend positions and automatically hedges when key support/resistance levels break, protecting your capital from reversals.
📊 Market Structure Detection:
Uptrend Structure:
✅ Higher Highs (HH): Each swing high is higher than the previous
✅ Higher Lows (HL): Each swing low is higher than the previous
🟢 Green triangles and lines
Downtrend Structure:
✅ Lower Highs (LH): Each swing high is lower than the previous
✅ Lower Lows (LL): Each swing low is lower than the previous
🔴 Red/Orange triangles and lines
💡 Trading Logic:
Primary Positions (Trend Following):
UPTREND:
Long Entry: Price breaks above Higher High
Opens 2x position size
Follows the trend
Green triangle marker
DOWNTREND:
Short Entry: Price breaks below Lower Low
Opens 2x position size
Follows the trend
Red triangle marker
Hedge Positions (Risk Protection):
When LONG (Uptrend):
Hedge Short: If price breaks below Higher Low (HL)
Support broken = potential reversal
Opens 1x SHORT position (hedge)
Orange X marker
Up to 2 hedge positions allowed
When SHORT (Downtrend):
Hedge Long: If price breaks above Lower High (LH)
Resistance broken = potential reversal
Opens 1x LONG position (hedge)
Aqua X marker
Up to 2 hedge positions allowed
🛡️ How Hedging Works:
Example Scenario:
Bot opens LONG (2x size) on Higher High break
Price pulls back and breaks Higher Low (support)
Bot opens HEDGE SHORT (1x size) automatically
Net Position: Still LONG 1x (2 - 1 = 1)
Protection: If trend reverses, hedge minimizes loss
If trend resumes: Close hedge, keep primary position
📈 Risk Management:
Stop Loss Options:
Fixed percentage-based (2% default)
Applied to all positions
Protects capital from major moves
Take Profit:
Fixed percentage (3% default)
Locks in profits automatically
Optional toggle
Position Sizing:
Primary: 50% equity (2x with pyramiding)
Hedge: 25% equity (1x)
Max 2 hedge positions per primary
🎨 Visual Features:
Swing Point Markers:
🔼 Triangles up: Swing lows (Green = HL, Red = LL)
🔽 Triangles down: Swing highs (Green = HH, Orange = LH)
Lines: Connect swing points showing structure
Support/Resistance Zones:
Red zones: Previous swing highs (resistance)
Green zones: Previous swing lows (support)
Automatically extend to right
Entry Signals:
🟢 Large green triangle: Primary long entry
🔴 Large red triangle: Primary short entry
🟠 Orange X: Hedge short entry
🔵 Aqua X: Hedge long entry
📊 Info Table Shows:
Market Structure: Uptrend ↑ / Downtrend ↓ / Neutral
Previous High/Low: Key levels being monitored
Primary Position: Current trend position
Hedge Count: How many hedges are active
Net Position: Actual market exposure
Open P&L: Real-time profit/loss
Performance Stats: Total trades, net profit
⚙️ Settings:
Swing Detection:
Length: 5 bars (adjustable 2-20)
Smaller = more swings, more signals
Larger = major swings only
Hedge Options:
Toggle hedge on/off
Auto-close hedges on retrace
Max number of hedges (1-3)
Risk Settings:
Stop loss percentage
Take profit percentage
Toggle each independently
🎯 Use Cases:
Best For:
Volatile markets with false breaks
Protecting trending positions
Risk-averse traders
Swing trading timeframes (15m - 4H)
Strategy Benefits:
✅ Automatic risk protection
✅ Reduces drawdown
✅ Captures reversals
✅ No manual intervention needed
✅ Clear visual feedback
This is a sophisticated hedging bot that automatically protects your positions while keeping you in profitable trends! 🚀
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.