OPEN-SOURCE SCRIPT

AK EMA 200 Trend Filter Strategy

150
Strategy Description – EMA 200 Trend Filter

This strategy uses the 200-period Exponential Moving Average (EMA) as a trend filter:

Entry Rule (Long only):

A long position is opened when the price crosses above the EMA 200 and closes above it.

Exit Rule:

The long position is closed if price closes back below the EMA 200.

Optional Short Trades (disabled by default, can be enabled):

A short position is opened when the price crosses below EMA 200 and closes below it.

The short is exited when price closes back above EMA 200.

Risk Management:

Configurable Stop Loss (%) and Take Profit (%) from entry price.

If enabled, trades are automatically protected with SL/TP levels.

Visualization:

EMA 200 is plotted in orange on the chart.

Green arrows mark long entries, red arrows mark exits.

✅ Use cases:

Works best on higher timeframes (1H, 4H, Daily) as a trend-following filter.

You can combine with additional indicators (RSI, MACD) to reduce false signals.

Always test in TradingView Strategy Tester before using in live trading.

Disclaimer

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.