Strategy · Pine Script v6 · On the chart

PF Probe Trendmaster Integration

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

This strategy combines a three-tier EMA stack, RSI momentum filtering, and channel breakout rules to generate trend-following entries on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code124
Settings9inputs
LicenceApache-2.0
Last update7 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

124 lines of Pine Script v6 from validation/composite-trendmaster-integration-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-integration — line projection + EMA stack + composite gate + pivot bracket
// Clean-room: written from validation goal, not from source.
//
// Purpose: composes the four surfaces isolated by `trendmaster-probe-01..04`
// into a single end-to-end trend strategy. The engine surface under test
// is the cross-surface composition:
//   - pivot detection drives both line projection AND bracket anchors,
//   - three-tier EMA stack provides regime gating AND the trend predicate,
//   - RSI + 20-bar breakout add momentum + structure filters,
//   - `strategy.exit` places pivot-anchored TP/SL once filled.
// Entries fire only when ALL gates align: stack regime matches direction,
// composite gate (trend+momentum+structure) is true, and a pivot anchor
// exists. `max_lines_count=500` keeps the drawing-object chain bounded.
//
// Validation goal: bit-exact trade list against TradingView's broker emulator
// on the reference 15-minute ETH-USDT-USDT feed. Trade list parity is the
// pass criterion; line drawings are visual-only and need not be checked.
//
// 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-integration", shorttitle="PF_TMINT",
     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, max_lines_count=500)

// ---- inputs --------------------------------------------------------
int   i_pivot     = input.int(5,    "Pivot strength",    minval=2,  maxval=20)
int   i_ema_fast  = input.int(21,   "EMA fast",          minval=3,  maxval=100)
int   i_ema_mid   = input.int(55,   "EMA mid",           minval=10, maxval=200)
int   i_ema_slow  = input.int(200,  "EMA slow",          minval=50, maxval=500)
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)
float i_rr        = input.float(2.0, "Reward:risk ratio", minval=0.5, maxval=10.0, step=0.5)

// ---- pivot detection + retention ----------------------------------
float ph = ta.pivothigh(high, i_pivot, i_pivot)
float pl = ta.pivotlow(low,   i_pivot, i_pivot)

var float last_ph   = na
var float last_pl   = na
var int   last_ph_x = na
var int   last_pl_x = na
var float prev_ph_y = na
var int   prev_ph_x = na
var float prev_pl_y = na
var int   prev_pl_x = na

if not na(ph)
    int cur_x = bar_index - i_pivot
    if not na(last_ph) and not na(last_ph_x)
        line.new(last_ph_x, last_ph, cur_x, ph, color=color.red)
    prev_ph_y := last_ph
    prev_ph_x := last_ph_x
    last_ph   := ph
    last_ph_x := cur_x

if not na(pl)
    int cur_x = bar_index - i_pivot
    if not na(last_pl) and not na(last_pl_x)
        line.new(last_pl_x, last_pl, cur_x, pl, color=color.green)
    prev_pl_y := last_pl
    prev_pl_x := last_pl_x
    last_pl   := pl
    last_pl_x := cur_x

// ---- EMA stack regime ---------------------------------------------
float ema_fast = ta.ema(close, i_ema_fast)
float ema_mid  = ta.ema(close, i_ema_mid)
float ema_slow = ta.ema(close, i_ema_slow)

bool stack_bull = ema_fast > ema_mid and ema_mid > ema_slow
bool stack_bear = ema_fast < ema_mid and ema_mid < ema_slow

// ---- composite gate (trend + momentum + structure) ----------------
bool trend_bull = ema_fast > ema_mid
bool trend_bear = ema_fast < ema_mid

float r = ta.rsi(close, i_rsi_len)
bool mom_bull = r > i_rsi_lo
bool mom_bear = r < i_rsi_hi

// 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

bool gate_long  = trend_bull and mom_bull and struct_bull
bool gate_short = trend_bear and mom_bear and struct_bear

// ---- final entry signals (stack + gate + pivot anchor) -----------
bool go_long  = stack_bull and gate_long  and not na(last_pl)
bool go_short = stack_bear and gate_short and not na(last_ph)

if go_long and strategy.position_size <= 0
    strategy.entry("L", strategy.long, qty=1, comment="integ trend long")

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

// ---- pivot-anchored bracket --------------------------------------
float entry_px = strategy.position_avg_price

if strategy.position_size > 0 and not na(last_pl)
    float sl_px = last_pl
    float tp_px = entry_px + (entry_px - last_pl) * i_rr
    strategy.exit("Brk", from_entry="L", stop=sl_px, limit=tp_px)

if strategy.position_size < 0 and not na(last_ph)
    float sl_px = last_ph
    float tp_px = entry_px - (last_ph - entry_px) * i_rr
    strategy.exit("Brk", from_entry="S", stop=sl_px, limit=tp_px)

Overview

PF Probe Trendmaster Integration detects swing highs and swing lows to draw connecting trend lines across pivot points. Entries trigger when the moving averages align, price breaks out of the historical window, and RSI confirms the direction. Upon entry, bracket exits establish a stop loss at the recent pivot level with a take profit defined by the configured reward-to-risk ratio.

Details

Published by

pineforge-4pass on GitHub

Code credit

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

Draws

On the price chart

Markets

Crypto

Timeframes

M15-H1

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

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

Settings

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

SettingTypeDefaultVariable
Pivot strengthint5i_pivot
EMA fastint21i_ema_fast
EMA midint55i_ema_mid
EMA slowint200i_ema_slow
RSI lengthint14i_rsi_len
RSI long thresholdfloat55i_rsi_lo
RSI short thresholdfloat45i_rsi_hi
Breakout windowint20i_break_len
Reward:risk ratiofloat2.0i_rr
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 2 days ago · 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 8 days ago · None stated GitHub repository of RSI EMA Breakout

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers