OPEN-SOURCE SCRIPT
Dual MA Crossover + Volatility Filter

Overview
The Dual MA Crossover + Volatility Filter is a comprehensive, trend-following framework designed primarily for futures and high-liquidity assets. Unlike standard moving average strategies that suffer during "choppy" or sideways markets, this system employs a multi-layered filtering process to ensure trades are only taken when momentum, volatility, and timing are in alignment.
Core Logic
The strategy triggers a signal when a Fast Moving Average crosses a Slow Moving Average. However, the signal must pass through three distinct "gates" before an order is executed:
Volatility Expansion Filter (ATR): Compares a short-term ATR against a longer-term baseline. Entries are only permitted when current volatility is higher than the baseline, signaling that a "breakout" or strong trend is likely beginning.
Momentum Filter (RSI): Confirmation of the trend's strength. Longs are only taken if RSI is above a user-defined threshold (default 50), ensuring we are not buying a "dead cat bounce."
Session Time Filter: Specifically designed for intraday traders. It allows users to skip the initial market "noise" (e.g., the first 30 minutes of the NY open) before allowing entries.
Key Features
Dynamic Risk Management: Automatically calculates position size based on a fixed percentage of account equity and the current ATR-based stop distance.
Smart Exit Logic: * Initial Stop: Set at a multiple of ATR from entry.
Breakeven Trigger: Moves the stop to entry price once the trade reaches a user-defined "R" (Risk) multiple.
Trailing Stop: Activates a trailing ATR-stop only after the breakeven trigger is hit, protecting profits during extended trends.
Time Stop: Closes the position if the market fails to make a new High (long) or Low (short) within a specific number of bars.
Futures Optimized: Includes built-in point value calculations for major contracts like ES, NQ, RTY, CL, and GC.
How to Use
Select MA Type: Choose between EMA, SMA, WMA, or HMA based on your preference for speed vs. lag.
Adjust Volatility Filter: If the strategy is too selective, increase the ATR Comparison Length.
Risk Settings: Set your Risk Percent per Trade (e.g., 1.0% for conservative trading).
Time Filter: On intraday charts (1m, 5m, 15m), set the Bars to Skip to avoid the opening volatility.
Disclaimer
This script is for educational and backtesting purposes only. Past performance does not guarantee future results. Trading futures and equities involves significant risk of loss
The Dual MA Crossover + Volatility Filter is a comprehensive, trend-following framework designed primarily for futures and high-liquidity assets. Unlike standard moving average strategies that suffer during "choppy" or sideways markets, this system employs a multi-layered filtering process to ensure trades are only taken when momentum, volatility, and timing are in alignment.
Core Logic
The strategy triggers a signal when a Fast Moving Average crosses a Slow Moving Average. However, the signal must pass through three distinct "gates" before an order is executed:
Volatility Expansion Filter (ATR): Compares a short-term ATR against a longer-term baseline. Entries are only permitted when current volatility is higher than the baseline, signaling that a "breakout" or strong trend is likely beginning.
Momentum Filter (RSI): Confirmation of the trend's strength. Longs are only taken if RSI is above a user-defined threshold (default 50), ensuring we are not buying a "dead cat bounce."
Session Time Filter: Specifically designed for intraday traders. It allows users to skip the initial market "noise" (e.g., the first 30 minutes of the NY open) before allowing entries.
Key Features
Dynamic Risk Management: Automatically calculates position size based on a fixed percentage of account equity and the current ATR-based stop distance.
Smart Exit Logic: * Initial Stop: Set at a multiple of ATR from entry.
Breakeven Trigger: Moves the stop to entry price once the trade reaches a user-defined "R" (Risk) multiple.
Trailing Stop: Activates a trailing ATR-stop only after the breakeven trigger is hit, protecting profits during extended trends.
Time Stop: Closes the position if the market fails to make a new High (long) or Low (short) within a specific number of bars.
Futures Optimized: Includes built-in point value calculations for major contracts like ES, NQ, RTY, CL, and GC.
How to Use
Select MA Type: Choose between EMA, SMA, WMA, or HMA based on your preference for speed vs. lag.
Adjust Volatility Filter: If the strategy is too selective, increase the ATR Comparison Length.
Risk Settings: Set your Risk Percent per Trade (e.g., 1.0% for conservative trading).
Time Filter: On intraday charts (1m, 5m, 15m), set the Bars to Skip to avoid the opening volatility.
Disclaimer
This script is for educational and backtesting purposes only. Past performance does not guarantee future results. Trading futures and equities involves significant risk of loss
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
dany
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
dany
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。