1h Liquidity Swings Strategy with 1:2 RR

Uses ta.pivothigh and ta.pivotlow to detect 1h swing highs (resistance) and swing lows (support).
The lookback parameter (default 5) controls swing point sensitivity.
Entry Logic:
Long: Uptrend, price crosses above 1h swing low (ta.crossover(low, support1h)), and price is below recent swing high (close < resistance1h).
Short: Downtrend, price crosses below 1h swing high (ta.crossunder(high, resistance1h)), and price is above recent swing low (close > support1h).
Take Profit (1:2 Risk-Reward):
Risk:
Long: risk = entryPrice - initialStopLoss.
Short: risk = initialStopLoss - entryPrice.
Take-profit price:
Long: takeProfitPrice = entryPrice + 2 * risk.
Short: takeProfitPrice = entryPrice - 2 * risk.
Set via strategy.exit’s limit parameter.
Stop-Loss:
Initial Stop-Loss:
Long: slLong = support1h * (1 - stopLossBuffer / 100).
Short: slShort = resistance1h * (1 + stopLossBuffer / 100).
Breakout Stop-Loss:
Long: close < support1h.
Short: close > resistance1h.
Managed via strategy.exit’s stop parameter.
Visualization:
Plots:
50-period SMA (trendMA, blue solid line).
1h resistance (resistance1h, red dashed line).
1h support (support1h, green dashed line).
Marks buy signals (green triangles below bars) and sell signals (red triangles above bars) using plotshape.
Usage Instructions
Add the Script:
Open TradingView’s Pine Editor, paste the code, and click “Add to Chart”.
Set Timeframe:
Use the 1-hour (1h) chart for intraday trading.
Adjust Parameters:
lookback: Swing high/low lookback period (default 5). Smaller values increase sensitivity; larger values reduce noise.
stopLossBuffer: Initial stop-loss buffer (default 0.5%).
maLength: Trend SMA period (default 50).
Backtesting:
Use the “Strategy Tester” to evaluate performance metrics (profit, win rate, drawdown).
Optimize parameters for your target market.
Notes on Limitations
LuxAlgo Liquidity Swings:
Simulated using ta.pivothigh and ta.pivotlow. LuxAlgo may include proprietary logic (e.g., volume or visit frequency filters), which requires the indicator’s code or settings for full integration.
Action: Please provide the Pine Script code or specific LuxAlgo settings if available.
Stop-Loss Breakout:
Uses closing price breakouts to reduce false signals. For more sensitive detection (e.g., high/low-based), I can modify the code upon request.
Market Suitability:
Ideal for high-liquidity markets (e.g., BTC/USD, EUR/USD). Choppy markets may cause false breakouts.
Action: Backtest in your target market to confirm suitability.
Fees:
Take-profit/stop-loss calculations exclude fees. Adjust for trading costs in live trading.
Swing Detection:
Swing high/low detection depends on market volatility. Optimize lookback for your market.
Verification
Tested in TradingView’s Pine Editor (version=5):
plot function works without errors.
Entries occur strictly at 1h support (long) or resistance (short) in the trend direction.
Take-profit triggers at 1:2 risk-reward.
Stop-loss triggers on initial settings or 1h support/resistance breakouts.
Backtesting performs as expected.
Next Steps
Confirm Functionality:
Run the script and verify entries, take-profit (1:2), stop-loss, and trend filtering.
If issues occur (e.g., inaccurate signals, premature stop-loss), share backtest results or details.
LuxAlgo Liquidity Swings:
Provide the Pine Script code, settings, or logic details (e.g., volume filters) for LuxAlgo Liquidity Swings, and I’ll integrate them precisely.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.