Strategy · Pine Script v6 · On the chart

PF Probe 4EMA-RSI-Probe-02-RSI-Pullback

by pineforge-4pass· code credited to PineForge contributors 2026

PF Probe 4EMA-RSI Probe 02 RSI Pullback is a stateful momentum strategy that triggers trades based on Relative Strength Index dip-and-recovery patterns.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code61
Settings5inputs
LicenceApache-2.0
Last update5 days ago23 Oct 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

61 lines of Pine Script v6 from validation/composite-4emarsi-rsi-pullback-latch-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe 4ema-rsi-probe-02-rsi-pullback — RSI dip-and-recover trigger
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates a two-state RSI pullback gate. The engine surfaces under
// test are `ta.rsi` (Wilder smoothing via `ta.rma`) and a cross-bar `var
// bool` latch that arms on a deep pullback and fires when RSI recovers
// through the midline. The latch is the parity-relevant piece — it depends
// on bar-by-bar evaluation order and on `ta.rsi`'s recursive smoothing
// matching the TV reference exactly.
//
// Validation goal: bit-exact long-entry list when RSI dips below the lower
// band and then crosses back above the midline; symmetric for shorts. Pass
// = identical trade list vs TradingView's broker emulator.
//
// TV setup: 15m chart, ETH-USDT-USDT (Binance USDT-M Perpetual). Full window
// matching corpus/data/ohlcv_ETH-USDT-USDT_15m.csv. Strategy properties:
// leave defaults from script header. Export "List of trades" → tv_trades.csv.
//@version=6
strategy("PF probe 4ema-rsi-probe-02-rsi-pullback", shorttitle="PF_4ema02_RSI",
     overlay=true, initial_capital=1000000,
     commission_type=strategy.commission.percent, commission_value=0,
     slippage=0, default_qty_type=strategy.fixed, default_qty_value=1,
     pyramiding=1, process_orders_on_close=false)

// ---- inputs --------------------------------------------------------
int   i_rsi_len  = input.int(14,   "RSI length",       minval=2)
float i_dip_lo   = input.float(40, "Long pullback band",  minval=10, maxval=50)
float i_pop_lo   = input.float(50, "Long recovery line",  minval=40, maxval=60)
float i_dip_hi   = input.float(60, "Short pullback band", minval=50, maxval=90)
float i_pop_hi   = input.float(50, "Short recovery line", minval=40, maxval=60)

// ---- RSI base ------------------------------------------------------
float r = ta.rsi(close, i_rsi_len)

// ---- arm-and-fire latches (cross-bar) ------------------------------
var bool long_armed  = false
var bool short_armed = false

if r < i_dip_lo
    long_armed := true
if r > i_dip_hi
    short_armed := true

bool long_fire  = long_armed  and ta.crossover(r,  i_pop_lo)
bool short_fire = short_armed and ta.crossunder(r, i_pop_hi)

if long_fire
    long_armed := false
if short_fire
    short_armed := false

// ---- trivial entries on fire events --------------------------------
if long_fire and strategy.position_size <= 0
    strategy.entry("L", strategy.long, qty=1, comment="rsi pullback long")

if short_fire and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="rsi pullback short")

Overview

PF Probe 4EMA-RSI-Probe-02-RSI-Pullback arms a persistent long variable when RSI drops below a pullback threshold and opens a long trade when RSI crosses back above the recovery line. Similarly, short trades arm when RSI exceeds an upper band and trigger when crossing below the short recovery level. Positions reverse on opposing signals without explicit stop loss or take profit targets. User settings adjust the RSI period, pullback bands, and recovery lines. It draws on the main price chart.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge contributors 2026, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Oscillators & momentum, Mean reversion

Markets

Crypto

Timeframes

M15-H1

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

Settings

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

SettingTypeDefaultVariable
RSI lengthint14i_rsi_len
Long pullback bandfloat40i_dip_lo
Long recovery linefloat50i_pop_lo
Short pullback bandfloat60i_dip_hi
Short recovery linefloat50i_pop_hi
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

Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit

Strategy v4 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of Alert BB + RSI [Alorse]
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

Strategy v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Strategy

This strategy draws on the price chart and combines Stochastic RSI, the Money Flow Index, and an exponential moving average to open long or short trades. Longs use the lower oscillator thresholds and shorts use the upper ones, with direction limited to longs,

Strategy v5 Oscillators & momentumMoving averages Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3 Indicator Strategy (StochRSI, MFI & EMA) With Safety Orders
104 stars

This strategy combines Bollinger Bands with a short RSI to fade moves that leave the bands and then return. A long requires the prior bar below the lower band and oversold, then a close back inside the band while RSI is between 30 and 50. Shorts mirror that at

Strategy v5 Oscillators & momentumVolatility & bands
Updated 3 years ago · MIT GitHub repository of Bollinger Bands and RSI Strategy
53 stars

This strategy implements Larry Connors' 2-period RSI mean-reversion algorithm overlaid on the price chart. It filters trades using a long-term Simple Moving Average (SMA), entering long positions when the price trades above the SMA and the short-term RSI drops

Strategy v6 Oscillators & momentumMean reversion
Updated 2 months ago · MPL-2.0 GitHub repository of Larry Connors 2-Period 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