OPEN-SOURCE SCRIPT
Strategy: HMA 50 + Supertrend Sniper

HMA 50 + Supertrend Confluence Strategy (Trend Following with Noise Filtering)
Description:
Introduction and Concept This strategy is designed to solve a common problem in trend-following trading: Lag vs. False Signals. Standard Moving Averages often lag too much, while price action indicators can generate false signals during choppy markets. This script combines the speed of the Hull Moving Average (HMA) with the volatility-based filtering of the Supertrend indicator to create a robust "Confluence System."
The primary goal of this script is not just to overlay two indicators, but to enforce a strict rule where a trade is only taken when Momentum (HMA) and Volatility Direction (Supertrend) are in perfect agreement.
Why this combination? (The Logic Behind the Mashup)
Hull Moving Average (HMA 50): We use the HMA because it significantly reduces lag compared to SMA or EMA by using weighted calculations. It acts as our primary Trend Direction detector. However, HMA can be too sensitive and "whipsaw" during sideways markets.
Supertrend (ATR-based): We use the Supertrend (Factor 3.0, Period 10) as our Volatility Filter. It uses Average True Range (ATR) to determine the significant trend boundary.
How it Works (Methodology) The strategy uses a boolean logic system to filter out low-quality trades:
Bullish Confluence: The HMA must be rising (Slope > 0) AND the Close Price must be above the Supertrend line (Uptrend).
Bearish Confluence: The HMA must be falling (Slope < 0) AND the Close Price must be below the Supertrend line (Downtrend).
The "Choppy Zone" (Noise Filter): This is a unique feature of this script. If the HMA indicates one direction (e.g., Rising) but the Supertrend indicates the opposite (e.g., Downtrend), the market is considered "Choppy" or indecisive. In this state, the script paints the candles or HMA line Gray and exits all positions (optional setting) to preserve capital.
Visual Guide & Signals To make the script easy to interpret for traders who do not read Pine Script, I have implemented specific visual cues:
Green Cross (+): Indicates a LONG entry signal. Both HMA and Supertrend align bullishly.
Red Cross (X): Indicates a SHORT entry signal. Both HMA and Supertrend align bearishly.
Thick Line (HMA): The main line changes color based on the trend.
Green: Bullish Confluence.
Red: Bearish Confluence.
Gray: Divergence/Choppy (No Trade Zone).
Thin Step Line: This is the Supertrend line, serving as your dynamic Trailing Stop Loss.
Strategy Settings
HMA Length: Default is 50 (Mid-term trend).
ATR Factor/Period: Default is 3.0/10 (Standard for trend catching).
Exit on Choppy: A toggle switch allowing users to decide whether to hold through noise or exit immediately when indicators disagree.
Risk Warning This strategy performs best in trending markets (Forex, Crypto, Indices). Like all trend-following systems, it may experience drawdown during prolonged accumulation/distribution phases. Please backtest with your specific asset before using it with real capital.
Description:
Introduction and Concept This strategy is designed to solve a common problem in trend-following trading: Lag vs. False Signals. Standard Moving Averages often lag too much, while price action indicators can generate false signals during choppy markets. This script combines the speed of the Hull Moving Average (HMA) with the volatility-based filtering of the Supertrend indicator to create a robust "Confluence System."
The primary goal of this script is not just to overlay two indicators, but to enforce a strict rule where a trade is only taken when Momentum (HMA) and Volatility Direction (Supertrend) are in perfect agreement.
Why this combination? (The Logic Behind the Mashup)
Hull Moving Average (HMA 50): We use the HMA because it significantly reduces lag compared to SMA or EMA by using weighted calculations. It acts as our primary Trend Direction detector. However, HMA can be too sensitive and "whipsaw" during sideways markets.
Supertrend (ATR-based): We use the Supertrend (Factor 3.0, Period 10) as our Volatility Filter. It uses Average True Range (ATR) to determine the significant trend boundary.
How it Works (Methodology) The strategy uses a boolean logic system to filter out low-quality trades:
Bullish Confluence: The HMA must be rising (Slope > 0) AND the Close Price must be above the Supertrend line (Uptrend).
Bearish Confluence: The HMA must be falling (Slope < 0) AND the Close Price must be below the Supertrend line (Downtrend).
The "Choppy Zone" (Noise Filter): This is a unique feature of this script. If the HMA indicates one direction (e.g., Rising) but the Supertrend indicates the opposite (e.g., Downtrend), the market is considered "Choppy" or indecisive. In this state, the script paints the candles or HMA line Gray and exits all positions (optional setting) to preserve capital.
Visual Guide & Signals To make the script easy to interpret for traders who do not read Pine Script, I have implemented specific visual cues:
Green Cross (+): Indicates a LONG entry signal. Both HMA and Supertrend align bullishly.
Red Cross (X): Indicates a SHORT entry signal. Both HMA and Supertrend align bearishly.
Thick Line (HMA): The main line changes color based on the trend.
Green: Bullish Confluence.
Red: Bearish Confluence.
Gray: Divergence/Choppy (No Trade Zone).
Thin Step Line: This is the Supertrend line, serving as your dynamic Trailing Stop Loss.
Strategy Settings
HMA Length: Default is 50 (Mid-term trend).
ATR Factor/Period: Default is 3.0/10 (Standard for trend catching).
Exit on Choppy: A toggle switch allowing users to decide whether to hold through noise or exit immediately when indicators disagree.
Risk Warning This strategy performs best in trending markets (Forex, Crypto, Indices). Like all trend-following systems, it may experience drawdown during prolonged accumulation/distribution phases. Please backtest with your specific asset before using it with real capital.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.