← Back to Indicators & Strategies

EMA/RSI Trend Strategy with Bot Alerts

Strategies

A TradingView strategy that trades a 9/21 EMA crossover with an RSI filter and RSI exits, and sends a JSON alert message that trading bots can read.

The Logic & Theory

A moving average crossover is one of the simplest ways to describe a change in trend. When a fast Exponential Moving Average (EMA) crosses above a slower one, price has recently been moving up faster than its longer average, and the opposite happens when it crosses below. Crossovers on their own often fire in sideways markets, so many traders add a momentum filter. The Relative Strength Index (RSI) measures the strength of recent moves on a scale of 0 to 100. A reading above 50 means recent gains have been stronger than recent losses, and below 50 means the opposite. Readings near 70 and 30 are commonly treated as stretched, or overbought and oversold. Combining a crossover with an RSI filter does not predict the future, it only asks that trend and momentum agree before a trade is opened.

How Our Custom Tool Helps

This is a Pine Script v6 strategy for TradingView. It enters a long trade when the 9 EMA crosses above the 21 EMA and RSI(14) is above 50, and a short trade when the 9 EMA crosses below the 21 EMA and RSI(14) is below 50. It closes trades using RSI levels at 70 and 30. The script is set up with an initial capital of 1,000 and 10% of equity per trade. It can also send a JSON alert message with the action, asset and price, which you can connect to a webhook if you want a bot to receive it. Signals are generated when a bar closes and the order is placed at the open of the next candle. The script does not use higher-timeframe data or calculate on every tick, so with the default settings its signals do not change after the bar has closed. This only holds if "Recalculate on every tick" stays switched off in the strategy properties. Any profit or loss figures you see in screenshots or in the Strategy Tester are results on a demo setup with a small test quantity. Past results do not guarantee future results, and this is not a trading signal or financial advice.

Interactive Demo: See the Difference

Drag the slider left and right to see how this tool transforms your chart.

Plain price chart without EMA/RSI Trend Strategy with Bot AlertsThe same chart with EMA/RSI Trend Strategy with Bot Alerts applied
<>

Real screenshots from a live TradingView chart. For education only, not a trading signal.

Premium Features & Alerts

  • Entry: 9 EMA crosses the 21 EMA, with RSI(14) above 50 for longs and below 50 for shorts
  • Exit: RSI levels at 70 and 30
  • Strategy Tester ready: initial capital 1,000 and 10% of equity per trade
  • JSON alert message (action, asset, price) for webhook and bot connections
  • Signals form at bar close and orders are placed at the next candle's open
  • No repainting with default settings, as long as "Recalculate on every tick" is off
  • Works on any symbol available in TradingView

Frequently Asked Questions

What are the entry and exit rules?

A long trade opens when the 9 EMA crosses above the 21 EMA while RSI (14) is above 50. A short trade opens when the 9 EMA crosses below the 21 EMA while RSI is below 50. Trades are closed by RSI levels (70 and 30 by default). All lengths and levels can be changed.

Do the profit figures in the screenshots show real results?

No. The figures on the screenshots come from a small demo setup and are not a promise of results. Backtests can differ from live trading.

Can it send alerts to a trading bot?

Yes. It can send alert messages in JSON format with the action, asset and price, which a webhook or bot service can read. The strategy itself does not place trades, and you should test any bot on a demo account first.

Does it repaint?

Signals are produced when a candle closes and orders are filled at the next candle's open. With the default settings, nothing changes after the candle has closed.

Want This Custom Script?

Get this indicator installed on your TradingView/MT5, or let us build a completely custom strategy just for you.

Size Your Trades Properly

More Custom Indicators & Scripts