Strategy · Pine Script v6 · On the chart

PineForge Breaker Method While

by pineforge-4pass· code credited to PineForge

The strategy builds a custom ThresholdLadder from RSI levels and counts how many levels the RSI value exceeds.

View on GitHub

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

56 lines of Pine Script v6 from validation/udt-breaker-method-while-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
//@version=6
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 PineForge
// PineForge Owned Strategy: Breaker Method While
// A bounded threshold ladder calls a typed method until an explicit break.
strategy("PineForge — Breaker Method While", overlay=true,
     initial_capital=100000,
     default_qty_type=strategy.fixed, default_qty_value=2,
     pyramiding=0, commission_type=strategy.commission.percent,
     commission_value=0.05, slippage=1,
     margin_long=100, margin_short=100,
     process_orders_on_close=false, calc_on_order_fills=false)

type ThresholdLadder
    float firstLevel
    float increment

method levelAt(ThresholdLadder self, int index) =>
    self.firstLevel + self.increment * index

firstLevel = input.float(42.0, "First RSI Level", minval=10, maxval=70, step=1, group="Ladder")
levelIncrement = input.float(4.0, "Level Increment", minval=1, maxval=12, step=0.5, group="Ladder")
maximumLevel = input.float(70.0, "Maximum RSI Level", minval=40, maxval=90, step=1, group="Ladder")
maximumSteps = input.int(10, "Maximum Steps", minval=2, maxval=16, group="Ladder")
requiredPasses = input.int(4, "Required Passed Levels", minval=1, maxval=10, group="Ladder")
trendLength = input.int(45, "Trend EMA Length", minval=5, group="Trend")
atrLength = input.int(17, "ATR Length", minval=2, group="Risk")
maximumAtrLoss = input.float(2.3, "Maximum ATR Loss", minval=0.5, step=0.1, group="Risk")

ThresholdLadder ladder = ThresholdLadder.new(firstLevel, levelIncrement)
rsiValue = ta.rsi(close, 14)
int index = 0
int passedLevels = 0
while index < maximumSteps
    currentLevel = ladder.levelAt(index)
    if currentLevel > maximumLevel
        break
    if rsiValue > currentLevel
        passedLevels += 1
    index += 1

trendLine = ta.ema(close, trendLength)
atrValue = ta.atr(atrLength)
ladderReady = passedLevels >= requiredPasses

enterLong = ladderReady and not ladderReady[1] and close > trendLine
ladderEnded = passedLevels < math.max(requiredPasses - 2, 1) or close < trendLine
riskExceeded = strategy.position_size > 0 and close < strategy.position_avg_price - atrValue * maximumAtrLoss

if strategy.position_size == 0 and enterLong
    strategy.entry("Breaker Long", strategy.long)
else if strategy.position_size > 0 and (ladderEnded or riskExceeded)
    strategy.close("Breaker Long", comment=riskExceeded ? "ATR risk" : "Ladder ended")

plot(trendLine, "Trend EMA", color=color.orange)
plot(passedLevels, "Passed Levels", color=color.purple, display=display.data_window)

Overview

When the required passes are reached it enters long when price crosses above the EMA trend line. It exits the position if the ladder condition breaks or if ATR risk is exceeded. The main settings control ladder height, step size, trend filter length and ATR stop distance. All signals plot on the price chart.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Oscillators & momentum, Trend, Support & resistance

Markets

Any symbol

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
First RSI Levelfloat42.0firstLevel
Level Incrementfloat4.0levelIncrement
Maximum RSI Levelfloat70.0maximumLevel
Maximum Stepsint10maximumSteps
Required Passed Levelsint4requiredPasses
Trend EMA Lengthint45trendLength
ATR Lengthint17atrLength
Maximum ATR Lossfloat2.3maximumAtrLoss
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 overlays the price chart and looks for VWAP pullbacks. It goes long when a short SMA crosses above VWAP after RSI has been oversold within ten bars, and short on the opposite cross after RSI has been overbought. Optional Minervini-style moving-av

Strategy v5 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of Advanced VWAP-Momentum Pullback Trend Qualifier

This strategy trades 1-minute futures contracts on Binance. It plots pivot high and low resistance and support levels on the price chart, along with an EMA and a custom Cto indicator. Long and short entries trigger on EMA and Cto crossovers combined with price

Strategy v5 TrendMoving averages Repaints
Updated 2 years ago · None stated GitHub repository of Binancash Futures Strategy 1M Candles

This strategy identifies reversal opportunities based on liquidity sweeps and multi-gate confluence scoring. It evaluates setups using mandatory conditions such as swing sweeps, body and ATR filters, and dual EMA higher-timeframe trend alignment, alongside opt

Strategy v6 SMC / ICT / price actionTrend
Updated yesterday · MIT GitHub repository of Reversal Engine Score [WavesUnchained] Strategy
7 stars

This strategy plots dynamic pivot-based support and resistance trendlines on the price chart and trades breakouts beyond those lines. By default it allows longs only when EMA 50 is above EMA 200 and an RSI-SMA momentum filter is met, with an ATR entry buffer.

Strategy v6 TrendBreakout
Updated 12 months ago · None stated GitHub repository of Easy Trendline - XAUUSD 30m

Optimizer v1

by QuantGeekDev
7 stars

This strategy generates long signals on the price chart using multiple technical indicators. It computes EMA 70 and 100, SMA 70, ADX with DMI, CCI, and MACD values. A long entry occurs when EMA crossover condition, SMA condition, ADX above 15, CCI above 30, an

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of Optimizer v1

This strategy combines MACD momentum signals with support and resistance levels from pivot points and an EMA100 trend filter for long positions. It plots the 100-period EMA on the price chart and signals when price breaks above the EMA or forms bullish pivot p

Strategy v4 TrendOscillators & momentum
Updated 3 years ago · Apache-2.0 GitHub repository of MACD + Support / Resistance Long 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