Skip to main content

Basic EMA Crossover Strategy

Overview

The Basic EMA Crossover Strategy is one of the most popular trend-following trading strategies used by traders across stocks, futures, options, forex, and cryptocurrency markets. The strategy uses two Exponential Moving Averages (EMAs) to identify trend changes and generate Buy and Sell signals automatically. This strategy comes with built-in Mirrorpip Integration Code, allowing traders to automate their TradingView signals directly to supported exchanges without any coding.

What is an EMA?

EMA (Exponential Moving Average) is a moving average that gives more weight to recent price movements, making it more responsive than a Simple Moving Average (SMA). Traders commonly use EMA crossovers to identify:
  • Trend reversals
  • Trend continuations
  • Entry opportunities
  • Exit opportunities
Here is the source code of the strategy

How the Strategy Works

The strategy uses:
  • Fast EMA
  • Slow EMA
When the Fast EMA crosses the Slow EMA, a trading signal is generated.

Long Entry Logic

A Buy signal is generated when:
  • Fast EMA crosses above the Slow EMA.
  • The market shows bullish momentum.
Mirrorpip automatically places a Buy order on the connected exchange.

Example

Fast EMA: 20 Slow EMA: 50 If EMA 20 crosses above EMA 50: → Buy Signal Generated

Short Entry Logic

A Sell or Short signal is generated when:
  • Fast EMA crosses below the Slow EMA.
  • The market shows bearish momentum.
Mirrorpip automatically places a Sell/Short order on supported exchanges.

Example

Fast EMA: 20 Slow EMA: 50 If EMA 20 crosses below EMA 50: → Short Signal Generated

Fully Customizable EMA Settings

Users can configure both moving averages according to their trading style.

Fast EMA

Common values:
  • 9 EMA
  • 10 EMA
  • 20 EMA
  • 21 EMA

Slow EMA

Common values:
  • 50 EMA
  • 100 EMA
  • 200 EMA

Aggressive Setup

  • Fast EMA: 9
  • Slow EMA: 21
Suitable for:
  • Scalping
  • Intraday Trading

Balanced Setup

  • Fast EMA: 20
  • Slow EMA: 50
Suitable for:
  • Swing Trading
  • Trend Following

Conservative Setup

  • Fast EMA: 50
  • Slow EMA: 200
Suitable for:
  • Positional Trading
  • Long-Term Trend Identification

Profit Target Management

The strategy supports two independent profit targets.

Target 1 (T1)

Can be configured in:
  • Percentage (%)
  • Points
Examples:
  • 1%
  • 2%
  • 100 Points

Target 2 (T2)

Can be configured independently in:
  • Percentage (%)
  • Points
Examples:
  • 3%
  • 5%
  • 300 Points
This allows traders to book partial profits while keeping the remaining position open for larger market moves.

Stop Loss Management

The strategy includes flexible Stop Loss options.

Percentage-Based Stop Loss

Examples:
  • 1%
  • 2%
  • 3%

Point-Based Stop Loss

Examples:
  • 50 Points
  • 100 Points
  • 200 Points
Mirrorpip automatically exits the position if the stop loss level is reached.

Trailing Stop Loss (TSL)

The strategy includes a Trailing Stop Loss feature to protect profits during trending markets.

TSL Options

Users can configure:
  • Percentage-Based TSL
  • Point-Based TSL
Benefits:
  • Protects unrealized profits.
  • Allows winners to run.
  • Reduces the impact of sudden reversals.

Intraday and Positional Trading Modes

Intraday Mode

Best suited for:
  • Indian Stock Markets
  • Index Trading
  • Futures & Options
Recommended Timeframes:
  • 5 Minute
  • 15 Minute
  • 30 Minute

Positional Mode

Best suited for:
  • Cryptocurrency Markets
  • Forex Markets
  • International Indices
Recommended Timeframes:
  • 1 Hour
  • 4 Hour
  • Daily

Fully Automated with Mirrorpip

The strategy comes with pre-built Mirrorpip automation code.

Setup Process

  1. Add the strategy to your TradingView chart.
  2. Select Fast EMA and Slow EMA values.
  3. Configure Targets, Stop Loss, and Trailing Stop Loss.
  4. Create a TradingView Alert.
  5. Connect the alert with Mirrorpip.
  6. Mirrorpip automatically executes trades on your connected exchange account.
No manual intervention is required after setup.

Supported Exchanges

Mirrorpip supports automated execution on multiple exchanges, including:
  • Bybit
  • Binance
  • Delta Exchange
  • CoinSwitch
  • OKX
  • Bitget
  • Gate.io
  • KuCoin
  • Shark Exchange
and many more.

Advantages of EMA Crossover Strategy

  • Simple and easy to understand.
  • Works across multiple markets.
  • Suitable for beginners and experienced traders.
  • Identifies major trend changes.
  • Fully automatable using Mirrorpip.
  • Requires minimal chart analysis.

Limitations

Like all trend-following systems, EMA crossover strategies can generate false signals during sideways or highly choppy markets. To improve performance, traders often:
  • Use higher timeframes.
  • Combine with volume confirmation.
  • Use trend filters.
  • Apply proper risk management.

Risk Disclaimer

Trading involves risk and no strategy guarantees profits. Always:
  • Use appropriate position sizing.
  • Configure stop losses.
  • Test settings before live deployment.
  • Monitor exchange and TradingView connectivity regularly.

Conclusion

The Basic EMA Crossover Strategy is a powerful and beginner-friendly trend-following system that helps traders capture directional market moves. With customizable EMA periods, dual profit targets, stop loss, trailing stop loss, and built-in Mirrorpip integration, traders can fully automate their trading workflow across stocks, futures, forex, and cryptocurrency markets.