Strategy · Pine Script v6 · On the chart

Stella's RSI + EMA Crossover

by stella-entry

Stella's RSI + EMA Crossover is a momentum strategy that plots exponential moving averages directly on the price chart.

View on GitHub

GitHub stars3on the repository
Pine versionv6current
Lines of code98
Settings8inputs
LicenceMIT
Last update8 months ago22 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

98 lines of Pine Script v6 from strategies/rsi-ema-crossover.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

rsi-ema-crossover.pine
//@version=6
strategy("Stella's RSI + EMA Crossover", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// ============================================
// パラメーター設定
// ============================================
// RSI設定
rsiLength = input.int(14, "RSI期間", minval=1, maxval=50)
overbought = input.int(70, "買われすぎレベル", minval=50, maxval=100)
oversold = input.int(30, "売られすぎレベル", minval=0, maxval=50)

// EMA設定
emaLength = input.int(50, "EMA期間", minval=1, maxval=500)

// フィルター
useTrendFilter = input.bool(true, "200EMAトレンドフィルターを使用")
trendEmaLength = input.int(200, "トレンド判定EMA期間", minval=1, maxval=500)

// 損切り設定
useStopLoss = input.bool(true, "損切りを使用")
stopLossPercent = input.float(2.0, "損切り幅(%)", minval=0.1, maxval=10.0) / 100

// ============================================
// インジケーター計算
// ============================================
// RSI
rsi = ta.rsi(close, rsiLength)

// EMA
ema = ta.ema(close, emaLength)
trendEma = ta.ema(close, trendEmaLength)

// 表示
plot(ema, "EMA", color=color.blue, linewidth=2)
plot(useTrendFilter ? trendEma : na, "Trend EMA", color=color.orange, linewidth=2)

// RSIを別ウィンドウに表示(サブプロット)
// ※ overlay=trueなのでRSIは別途インジケーターとして追加推奨

// ============================================
// エントリー条件
// ============================================
// トレンド判定
isUptrend = close > trendEma
isDowntrend = close < trendEma

// RSI条件
rsiOversold = rsi < oversold
rsiOverbought = rsi > overbought
rsiRising = rsi > rsi[1]
rsiFalling = rsi < rsi[1]

// 価格条件
priceAboveEma = close > ema
priceBelowEma = close < ema

// ロング条件
// - RSIが売られすぎ域から上昇
// - 価格がEMAより上
// - (オプション)200EMAより上
longCondition = rsiOversold[1] and rsiRising and priceAboveEma
if useTrendFilter
    longCondition := longCondition and isUptrend

// ショート条件
// - RSIが買われすぎ域から下降
// - 価格がEMAより下
// - (オプション)200EMAより下
shortCondition = rsiOverbought[1] and rsiFalling and priceBelowEma
if useTrendFilter
    shortCondition := shortCondition and isDowntrend

// ============================================
// 売買実行
// ============================================
if longCondition
    strategy.entry("Long", strategy.long)

if shortCondition
    strategy.entry("Short", strategy.short)

// ============================================
// 損切り
// ============================================
if useStopLoss
    strategy.exit("SL Long", "Long", stop=strategy.position_avg_price * (1 - stopLossPercent))
    strategy.exit("SL Short", "Short", stop=strategy.position_avg_price * (1 + stopLossPercent))

// ============================================
// シグナルマーカー
// ============================================
plotshape(longCondition, "Long Signal", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(shortCondition, "Short Signal", shape.triangledown, location.abovebar, color.red, size=size.small)

// ============================================
// 背景色(トレンド表示)
// ============================================
bgcolor(useTrendFilter and isUptrend ? color.new(color.green, 95) : useTrendFilter and isDowntrend ? color.new(color.red, 95) : na)

Overview

Stella's RSI + EMA Crossover generates long signals when RSI turns up from oversold levels while price trades above the fast EMA and optional 200-period trend filter EMA. Short signals trigger when RSI turns down from overbought levels below the filter lines. Exits are controlled by an optional percentage-based stop loss or position reversals on opposing signals. Configurable settings include RSI thresholds, fast and slow EMA periods, trend filter toggles, and stop loss percentages.

Details

Published by

stella-entry on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Trend, Oscillators & momentum, Moving averages

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
RSI期間int14rsiLength
買われすぎレベルint70overbought
売られすぎレベルint30oversold
EMA期間int50emaLength
200EMAトレンドフィルターを使用booltrueuseTrendFilter
トレンド判定EMA期間int200trendEmaLength
損切りを使用booltrueuseStopLoss
損切り幅(%)float2.0stopLossPercent
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

330 stars

2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the

Strategy v4 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of 2 EMA/SMA + RSI Strategy [Alorse]

Acrypto - Weighted Strategy

by AlbertoCuadra
318 stars

This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · Custom licence GitHub repository of Acrypto - Weighted Strategy

This strategy combines Arnaud Legoux Moving Average percentage price change calculations with an adaptive Gaussian Moving Average to generate trend-following signals. Long and short entries are triggered when the ALMA change calculation crosses above or below

Strategy v5 Moving averagesOscillators & momentum
Updated 6 weeks ago · None stated GitHub repository of ESM2024 - ALMA Smoothed Gaussian Moving Average
218 stars

This strategy generates trading signals based on a selectable momentum engine, supporting MACD, RSI, Stochastic, or Rate of Change. Entries trigger on signal crosses, zero-line crosses, or threshold crosses, with an optional moving average trend filter. Risk m

Strategy v6 Oscillators & momentumTrend
Updated 3 months ago · None stated GitHub repository of Momentum Strategy Template

255 EMA Strategy

by hasnocool
106 stars

255 EMA Strategy combines an exponential moving average with Average True Range bands and standard MACD crossovers to generate entry signals. Drawn directly on the price chart, it plots the central 255 EMA along with upper and lower volatility envelopes. Trade

Strategy v4 Moving averagesOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 255 EMA Strategy

SMA RSI Strategy

by PythonForForex
64 stars

This strategy evaluates simple moving averages and the Relative Strength Index to generate trading signals. It calculates a 10-period SMA, a 30-period SMA, and a 14-period RSI. Long positions are entered when the fast SMA crosses above the slow SMA while RSI i

Strategy v5 TrendOscillators & momentum
Updated 4 years ago · None stated GitHub repository of SMA RSI Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers