Dynamic SMA Trend System [Multi-Stage Risk Engine] — Strategy by oppliger79

By oppliger79

Performance Metrics

Description

Description:This script implements a robust Trend Following strategy based on a multiple Simple Moving Average (SMA) crossover logic (25, 50, 100, 200). What sets this strategy apart is its advanced "4-Stage Risk Engine" and a smart "High-Water Mark" Re-Entry system, designed to protect profits during parabolic moves while filtering out chop during sideways markets.How it works:The strategy operates on three core pillars: Trend Identification, Dynamic Risk Management, and Momentum Re-Entry.1. Entry Logic (Trend Identification) The script looks for crossovers at different trend stages to capture early reversals as well as established trends:Short-Term: SMA 25 crosses over SMA 50.Mid-Term: SMA 50 crosses over SMA 100.Macro-Trend: SMA 100 crosses over SMA 200.2. The 4-Stage Risk Engine (Dynamic Stop Loss) Instead of a static Stop Loss, this strategy uses a progressive system that adapts as the price increases:Stage 1 (Protection): Starts with a fixed Stop Loss (default -10%) to give the trade room to breathe.Stage 2 (Break-Even): Once the price rises by 12%, the Stop is moved to trailing mode (10% distance), effectively securing a near break-even state.Stage 3 (Profit Locking): At 25% profit, the trailing stop tightens to 8% to lock in gains.Stage 4 (Parabolic Mode): At 40% profit, the trailing stop tightens further to 5% to capture the peak of parabolic moves.3. Dual Exit Mechanism The strategy exits a position if EITHER of the following happens:Stop Loss Hit: Price falls below the dynamic red line (Risk Engine).Dead Cross: The trend structure breaks (e.g., SMA 25 crosses under SMA 50), signaling a momentum loss even if the Stop Loss wasn't hit.4. "High-Water Mark" Re-Entry To avoid "whipsaws" in choppy markets, the script does not re-enter immediately after a stop-out.It marks the highest price of the previous trade (Green Dotted Line).A Re-Entry only occurs if the price breaks above this previous high (showing renewed strength) AND the long-term trend is bullish (Price > SMA 200).Visuals:SMAs: 25 (Yellow), 50 (Orange), 100 (Blue), 200 (White).Red Line: Visualizes the dynamic Stop Loss level.Green Dots: Visualizes the target price needed for a valid re-entry.Settings: All parameters (SMA lengths, Stop Loss percentages, Staging triggers) are fully customizable in the settings menu to fit different assets (Crypto, Stocks, Forex) and timeframes.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView