Strategy · Pine Script v6 · On the chart

EUR/USD EMA9-21 + RSI Scalping Strategy

by Ahmed-GoCode· code credited to Ahmed - Quant-Edge Indicators

This strategy trades EUR/USD on the price chart using a fast and slow exponential moving average crossover filtered by RSI.

View on GitHub

GitHub stars53on the repository
Pine versionv6current
Lines of code40
Settings7inputs
LicenceMPL-2.0
Last update2 months ago17 Aug 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

40 lines of Pine Script v6 from Quant-Edge-Indicators/Trend & Breakout/EURUSD 1M Strategy.pinescript, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

EURUSD 1M Strategy.pinescript
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ahmed - Quant-Edge Indicators
//@version=6
strategy("EUR/USD EMA9-21 + RSI Scalping Strategy [1M]", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// === Parameters ===
emaFastLen = input.int(9, title="Fast EMA Period")
emaSlowLen = input.int(21, title="Slow EMA Period")
rsiLen = input.int(14, title="RSI Period")
rsiUpper = input.int(70, title="RSI Overbought")
rsiLower = input.int(30, title="RSI Oversold")
takeProfitPips = input.int(10, title="Take Profit (pips)")
stopLossPips = input.int(5, title="Stop Loss (pips)")

// === Calculations ===
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
rsi = ta.rsi(close, rsiLen)

// === Entry Conditions ===
longCond = ta.crossover(emaFast, emaSlow) and rsi > 50 and rsi < rsiUpper
shortCond = ta.crossunder(emaFast, emaSlow) and rsi < 50 and rsi > rsiLower

// === Pip to Price Conversion ===
pip = 0.0001  // EUR/USD 5-decimal standard pip
tpPoints = takeProfitPips * pip
slPoints = stopLossPips * pip

// === Entries and Exits ===
if (longCond)
    strategy.entry("Buy", strategy.long)
    strategy.exit("Exit Buy", from_entry="Buy", limit=close + tpPoints, stop=close - slPoints)

if (shortCond)
    strategy.entry("Sell", strategy.short)
    strategy.exit("Exit Sell", from_entry="Sell", limit=close - tpPoints, stop=close + slPoints)

// === Visualization ===
plot(emaFast, title="EMA 9", color=color.blue)
plot(emaSlow, title="EMA 21", color=color.orange)

Overview

EUR/USD EMA9-21 + RSI Scalping Strategy enters long when the fast EMA crosses above the slow EMA while RSI is above 50 and below the overbought level, and enters short on the opposite cross while RSI is below 50 and above the oversold level. Exits use a fixed pip take profit and stop loss measured from the signal bar close. Inputs change EMA lengths, RSI period and thresholds, and pip targets. It plots both EMAs and sizes each order as a percent of equity.

Details

Published by

Ahmed-GoCode on GitHub

Code credit

Ahmed - Quant-Edge Indicators, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Trend, Moving averages, Oscillators & momentum, Scalping

Markets

Forex

Timeframes

M1-M5

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.

Topics

fair-value-gapfibonaccimarket-structurepine-scriptrsi-strategysmart-money-conceptstechnical-analysistradingviewalgorithmic-tradingcrypto-trading

Settings

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

SettingTypeDefaultVariable
Fast EMA Periodint9emaFastLen
Slow EMA Periodint21emaSlowLen
RSI Periodint14rsiLen
RSI Overboughtint70rsiUpper
RSI Oversoldint30rsiLower
Take Profit (pips)int10takeProfitPips
Stop Loss (pips)int5stopLossPips
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

This strategy generates trading signals on the 5-minute price chart using Williams Fractals for trend reversals, combined with EMA fast and slow trend filters and optional RSI confirmation. Long entries trigger on bullish fractals aligned with rising EMA and R

Strategy v5 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 5min Williams Fractals Scalping (3commas)
13 stars

This strategy plots on the price chart and enters from a moving-average filter, ADX and Gann colours. Price above a 200-period EMA allows only longs; price below allows only shorts. A Gann aqua colour with ADX above a key level opens a long, and a Gann brown c

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Ruckard TradingZone ADX Gann

Scalping 3EMA

by rodrigo-brito
9 stars

This long-only strategy calculates three exponential moving averages with lengths of 50, 100, and 150 periods, plotting them directly on the price chart. It also calculates a 14-period RSI and MACD. The strategy opens long positions when the moving averages al

Strategy v4 TrendOscillators & momentum
Updated 5 years ago · MIT GitHub repository of Scalping 3EMA
2 stars

This strategy executes trend-following scalping setups by combining fast and slow exponential moving averages with a smoothed Stochastic oscillator. It enters long positions when the fast EMA is above the slow EMA and the Stochastic is oversold, and short posi

Strategy v5 TrendOscillators & momentum Repaints
Updated 7 months ago · None stated GitHub repository of WINNER MNQ Strategy - Optimized 2026

PF_WS01_REV

by pineforge-4pass
1 stars

This strategy uses two exponential moving averages (fast period 5, slow period 13) to detect trend changes via crossover signals on the price chart. It enters long on fast EMA crossing above slow EMA and short on the reverse crossover. The script includes expl

Strategy v6 TrendOscillators & momentum
Updated 5 days ago · Apache-2.0 GitHub repository of PF_WS01_REV

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