Trend Signals with TP/SL + Liquidation Filter (Synced v3) β€” Strategy by Jojo67

By Jojo67

Performance Metrics

Description

πŸ“ˆ Trend Signals with TP/SL + Adaptive Liquidation Filter (Synced v3)This script is based on the original Trend Signals with TP/SL concept by UAlgo.The core structure and ATR-based execution model remain intact.This version extends the original implementation with an adaptive volatility-aware liquidation-style filter and synchronized entry logic.The intention is refinement β€” not replacement β€” of the original strategy logic.πŸ”Ή Core Engine (UAlgo Concept)The base system operates on:β€’ Hull-derived momentum shift detectionta.hma(open, 5)ta.hma(close, 12)Momentum changes are evaluated and converted into directional state transitions.β€’ ATR-based dynamic trailing bandsThe strategy calculates adaptive bands:up = src - Multiplier * ATRdn = src + Multiplier * ATRTrend flips occur when price crosses the opposing trailing level.β€’ State-based trend logicThe script maintains an internal trend variable that flips only when a full reversal condition is met.Signals:buySignal β†’ trend changes from -1 to +1sellSignal β†’ trend changes from +1 to -1All signals are confirmed on barstate.isconfirmed to prevent repainting.πŸ”Ή Adaptive Liquidation Filter (Extension Layer)This version introduces a volatility-adjusted filtering system.1️⃣ Volatility AdaptationATR is compared against a smoothed ATR baseline:volRatio = ATR(14) / SMA(ATR, 30)Smoothing lengths are dynamically adjusted:liq_len / pow(volRatio, adaptStrength)liq_len2 / pow(volRatio, adaptStrength)Lengths are clamped to safe bounds to avoid instability.This makes the filter:More reactive in high volatilityMore stable in low volatility2️⃣ Hybrid Midline ConstructionInstead of a single MA:Adaptive SMAManually calculated EMAAveraged midlineavgLine = (ma1 + ma2) / 23️⃣ Deviation-Based Extreme DetectionDistance from midline:distVal = ((source - avgLine) / avgLine) * 100Optional tolerance removes minor noise:abs(distVal) > toleranceExtremes are detected via rolling highest/lowest comparison over liq_pctWindow.Optional cluster logic ensures minimum signal density before confirmation.All confirmations occur on candle close (no repaint).πŸ”Ή Entry LogicFinal entry condition:trend flipAND liquidation filter confirmationAND bar close confirmationAND optional single-position enforcementThis creates a two-layer confirmation system:Directional shiftStatistically significant displacementπŸ”Ή Risk ModelPrimary mode: ATR-based TP/SLLong:SL = entry - ATR * sl_multiplierTP = entry + ATR * tp_multiplierShort is mirrored.Percent-based option is available but ATR mode is default.Orders are executed via strategy.entry() and strategy.exit() for native engine handling.πŸ”Ή Structural Design ChoicesNo repainting logicNo intrabar executionNo future data accessFully state-driven trend modelVolatility-adaptive smoothingSynchronized execution and alertsπŸ”Ή Intended BehaviorThe strategy aims to:Reduce entries during low-momentum chopMaintain participation in structured trendsAvoid over-filtering in expansion phasesIt is not optimized for scalping or micro-structure trading.πŸ”Ή Development NotesThis script is published open-source for further refinement and experimentation.Possible areas for improvement:Regime detection layerDynamic ATR multipliersPosition sizing modelEquity curve protection logicVolume confirmation integration_____________________________-I tested the strategy live and it works perfectly.What I noticed is that it doesn't close the trade with Exit but with Buy or Sell. If anyone knows Pine, they will surely be able to fix it.Have fun developing it further :-)

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView