A 50-period Exponential Moving Average (EMA) is used to determine the overall trend.
trendUp is true when the price is above the EMA.
trendDown is true when the price is below the EMA.
Momentum Filter (RSI):
A 14-period RSI is used to identify overbought and oversold conditions.
oversold is true when RSI ≤ 30.
overbought is true when RSI ≥ 70.
Volatility Filter (ATR):
A 14-period Average True Range (ATR) is used to measure volatility.
ATR is multiplied by a user-defined multiplier (default: 2.0) to set a volatility threshold.
Ensures trades are only taken during periods of sufficient volatility.
Entry Conditions:
Long Entry: Price is above the EMA (uptrend), RSI is oversold, and the candle range exceeds the ATR threshold.
Short Entry: Price is below the EMA (downtrend), RSI is overbought, and the candle range exceeds the ATR threshold.
Exit Conditions:
Take Profit: A fixed percentage above/below the entry price.
Stop Loss: A fixed percentage below/above the entry price.
Visualization:
The EMA is plotted on the chart.
Background colors highlight uptrends and downtrends.
Buy and sell signals are displayed as labels on the chart.
Alerts:
Alerts are triggered for buy and sell signals.
How to Use the Indicator Trend Filter:
Only take trades in the direction of the trend (e.g., long in an uptrend, short in a downtrend).
Momentum Filter:
Look for oversold conditions in an uptrend for long entries.
Look for overbought conditions in a downtrend for short entries.
Volatility Filter:
Ensure the candle range exceeds the ATR threshold to avoid low-volatility trades.
Risk Management:
Use the built-in take profit and stop loss levels to manage risk.
Optimization Tips Backtesting:
Test the indicator on multiple timeframes and assets to evaluate its performance.
Adjust the input parameters (e.g., EMA length, RSI length, ATR multiplier) to optimize for specific markets.
Combination with Other Strategies:
Add additional filters, such as volume analysis or support/resistance levels, to improve accuracy.
Risk Management:
Use proper position sizing and risk-reward ratios to maximize profitability.
Disclaimer No indicator can guarantee an 85% win ratio due to the inherent unpredictability of financial markets. This script is provided for educational purposes only. Always conduct thorough backtesting and paper trading before using any strategy in live trading.
Let me know if you need further assistance or enhancements!
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.