OPEN-SOURCE SCRIPT

EMA Crossover with RSI Filter

EMA Crossover with RSI
Overview:

This strategy capitalizes on trend shifts by using a fast EMA (6-period) crossing a slow EMA (200-period) combined with an RSI filter for confirmation. It is optimized for a 4-hour timeframe to capture medium-term trends with fewer noise signals. Starting with an initial capital of $100, it reinvests 100% of equity in each trade and includes a 0.05% commission for realistic backtesting.
Strategy Setup:

Suggested Timeframe: 4-hour chart for balanced trend-capturing and signal accuracy.
Initial Capital: $100
Position Size: 100% of current equity per trade.
Commission: 0.05% per trade to simulate actual trading costs.

Indicators Used:

EMA (Exponential Moving Average):
6-period EMA: Tracks short-term price movements.
200-period EMA: Represents long-term trend direction.
RSI (Relative Strength Index):
14-period RSI: Adds a momentum filter to avoid false entries.

Entry and Exit Conditions:

Long Entry Condition:
Triggered when the 6-period EMA crosses above the 200-period EMA (bullish crossover).
RSI must be above 50 to confirm positive momentum.
When both conditions are met, a long position is opened.

Exit Condition:
The long position closes when the 6-period EMA crosses below the 200-period EMA (bearish crossover) and RSI is below 50, signaling a trend reversal.

Chart Display:

EMA Plots:
6-period EMA in green for short-term trends.
200-period EMA in red for long-term trend direction.

The 4-hour timeframe and commission consideration allow for realistic backtesting with an accurate view of net performance over time.
Double Exponential Moving Average (DEMA)emacrossoverRelative Strength Index (RSI)rsi-ema

Open-source script

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.

Want to use this script on a chart?


Also on:

Disclaimer