OPEN-SOURCE SCRIPT

MA Strategy: Dual Entry Filter

173
Configurable MA Dual-Filter Strategy
This strategy is an enhanced and highly configurable Moving Average (MA) Crossover system designed to mitigate false signals and align trades with the prevailing market trend. It is built to offer traders granular control over entry criteria, elevating it beyond basic, built-in MA crossover indicators.

Originality & Key Features
The script's originality and utility lie in the combination of its two primary, optional filtering mechanics:

Dual Entry Mode (Key Filter): Users can choose between two distinct methods for trade entry:

Crossover (Classic): Immediate entry when the price crosses the main MA.

Full Candle Confirmation (Unique Feature): This mode requires the entire candle body (open, high, low, and close) to be completely above or below the main MA after a crossover event to confirm the signal before entry. This strict confirmation helps to filter out weak crossovers, reducing whipsaws in choppy markets.

Optional Trend Filter: A second, slower MA (Trend Filter MA) can be activated. Trades are only permitted when the faster main MA is aligned with the slower Trend MA (i.e., long only if main MA > Trend MA), ensuring trades are executed with the established higher-timeframe direction.

How to Use the Strategy
The strategy logic is built on simple MA principles but utilizes Pine Script's switch function to allow users to select from six different MA types for both the main signal and the trend filter: SMA, EMA, WMA, HMA, VWMA, and RMA.

Core Logic:

Signal: A cross of the price over the Main MA (filtered by the chosen Entry Mode).

Directional Filter: The Trend Filter must confirm the direction (if enabled).

Exit: Trades are exited on the opposite price crossover of the Main MA.

Customizable Settings Include:

Main MA Type & Length (Default: 40 EMA): The primary signal generator.

Trend Filter MA Type & Length (Default: 70 EMA): The optional, slower trend bias.

Entry Mode: Switch between Crossover or Full Candle Confirmation.

Strategy Results and High-Risk Disclaimer
The default setting for trade size is set to 40% of equity for backtesting demonstration purposes only. This high value is used to generate a large and diverse sample size of trades for historical review on the chart.

This 40% value is NOT a recommended setting for live trading. Per TradingView guidelines, traders are strongly advised to change this input to a sustainable risk level, typically 5% to 10% of equity per trade. Past performance is not a guarantee of future results.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.