Strategy · Pine Script v6 · On the chart

PF Probe Trendmaster-Probe-04 Trend Entry Gate

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

This strategy evaluates a triple-confluence entry gate combining trend, momentum, and structure filters on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code73
Settings6inputs
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

73 lines of Pine Script v6 from validation/composite-trendmaster-trend-momentum-structure-gate-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 trendmaster-probe-04-trend-entry-gate — composite trend+momentum+structure gate
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates the composite-gate entry surface used by trend
// strategies that require multiple confluence factors before firing. Three
// independent predicates are AND-combined:
//
//   trend     = ema21 > ema55                              (long bias)
//   momentum  = ta.rsi(close, 14) > 55                     (momentum confirm)
//   structure = close > ta.highest(high, 20)[1]            (20-bar breakout)
//
// All three must be true on the same bar. Short is the symmetric inversion.
// The engine surface under test is the boolean conjunction of three
// different ta.* recursion families on a single bar — any single drift
// (EMA, RSI, or rolling-highest) flips the gate to false and a trade goes
// missing.
//
// Validation goal: bit-exact trade list against TradingView's broker emulator
// on the reference 15-minute ETH-USDT-USDT feed.
//
// 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 trendmaster-probe-04-trend-entry-gate", shorttitle="PF_TM04_GATE",
     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_fast      = input.int(21, "Trend EMA fast", minval=3,  maxval=100)
int   i_slow      = input.int(55, "Trend EMA slow", minval=10, maxval=200)
int   i_rsi_len   = input.int(14, "RSI length",     minval=2,  maxval=50)
float i_rsi_lo    = input.float(55, "RSI long threshold",  minval=50, maxval=80)
float i_rsi_hi    = input.float(45, "RSI short threshold", minval=20, maxval=50)
int   i_break_len = input.int(20, "Breakout window", minval=5,  maxval=200)

// ---- predicate 1: trend -------------------------------------------
float ema_fast = ta.ema(close, i_fast)
float ema_slow = ta.ema(close, i_slow)
bool trend_bull = ema_fast > ema_slow
bool trend_bear = ema_fast < ema_slow

// ---- predicate 2: momentum ----------------------------------------
float r = ta.rsi(close, i_rsi_len)
bool mom_bull = r > i_rsi_lo
bool mom_bear = r < i_rsi_hi

// ---- predicate 3: structure (prior-bar breakout reference) -------
// History access on chained ta.* calls hits a transpiler limitation;
// assign to a series-float carrier first, then take [1].
float hi_now   = ta.highest(high, i_break_len)
float lo_now   = ta.lowest(low,   i_break_len)
float break_hi = hi_now[1]
float break_lo = lo_now[1]
bool struct_bull = close > break_hi
bool struct_bear = close < break_lo

// ---- composite gate -----------------------------------------------
bool go_long  = trend_bull and mom_bull and struct_bull
bool go_short = trend_bear and mom_bear and struct_bear

// ---- routing -------------------------------------------------------
if go_long and strategy.position_size <= 0
    strategy.entry("L", strategy.long, qty=1, comment="gate long")

if go_short and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="gate short")

Overview

PF Probe Trendmaster-Probe-04 Trend Entry Gate enters long when a fast exponential moving average is above a slow exponential moving average, RSI exceeds a defined threshold, and the close breaks above the prior breakout window high. Symmetric inverse logic triggers short entries. Settings customize EMA lengths, RSI parameters, and the breakout lookback window. The strategy lacks stop-loss or take-profit exits, relying on opposing signals to flip positions.

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

Trend, Oscillators & momentum, Moving averages, Breakout

Markets

Crypto

Timeframes

Any timeframe

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
Trend EMA fastint21i_fast
Trend EMA slowint55i_slow
RSI lengthint14i_rsi_len
RSI long thresholdfloat55i_rsi_lo
RSI short thresholdfloat45i_rsi_hi
Breakout windowint20i_break_len
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

ADA4H Optuna Strategy

by skywalker0803r
42 stars

This strategy trades longs and shorts on the price chart. Long entries require a close above the prior Donchian high, a close above a long-term SMA, and RSI above a threshold, with size set as a percentage of equity. Long exits use a stop at the prior Donchian

Strategy v5 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of ADA4H Optuna Strategy

Edge 59

by subos2008
6 stars

Edge 59 is a price-chart strategy that combines an ADX directional filter, a weighted moving average, and a trend-follower channel. The channel uses an exponential moving average of close, optionally smoothed by linear regression, and a percentage of a fixed 2

Strategy v5 TrendOscillators & momentum Repaints
Updated 2 years ago · Custom licence GitHub repository of Edge 59

AG Momentum Breakout

by eltonaguiar
4 stars

AG Momentum Breakout is a strategy that identifies continuation signals after pullbacks in trending markets. It filters for uptrends using EMAs and detects recent pullbacks via RSI conditions before entering on RSI crossovers above 50 with ADX confirmation. Th

Strategy v6 TrendOscillators & momentum
Updated today · None stated GitHub repository of AG Momentum Breakout
4 stars

Christian Qullamaggie Strategy is a trend-following and breakout strategy overlay designed to identify high-momentum trading opportunities directly on the price chart. It evaluates market conditions using fast, mid, and slow EMAs, average true range (ATR), and

Strategy v6 BreakoutTrend
Updated 7 months ago · None stated GitHub repository of Christian Qullamaggie Strategy

RSI-7 Breakout

by aofwittawat
4 stars

This strategy identifies breakout trades using a 7-period RSI combined with price extreme lookbacks. A long entry triggers when the RSI rises above 70 and price reaches a new lookback high, provided price remains above an optional EMA trend filter and passes a

Strategy v5 Oscillators & momentumBreakout
Updated 4 years ago · None stated GitHub repository of RSI-7 Breakout

RSI EMA Breakout

by latentwill
4 stars

This strategy trades momentum breakouts by combining an Exponential Moving Average with the Relative Strength Index. It enters a long position when the closing price is above the EMA and the RSI crosses above the breakout threshold. It enters a short position

Strategy v5 TrendOscillators & momentum
Updated 6 days ago · None stated GitHub repository of RSI EMA Breakout

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