Strategy · Pine Script v6 · On the chart

PF probe 54 - MTF roll state

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

This strategy detects roll states in multiple timeframes to generate trading signals on the price chart.

View on GitHub

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

36 lines of Pine Script v6 from validation/mtf-roll-state-60-240-d-minimal-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 54 - minimal MTF roll state
//
// Purpose: isolate request.security state across 60m, 240m, and D contexts,
// without the large community strategy filters.
// TV setup: 15m chart, same symbol/window as data/ohlcv_ETH-USDT-USDT_15m.csv.
// Export TradingView "List of trades" to trades.csv in this folder.
//@version=6
strategy("PF probe 54 - MTF roll state", shorttitle="PF_P54_MTF", 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)

h60 = request.security(syminfo.tickerid, "60", close, lookahead=barmerge.lookahead_off)
h240 = request.security(syminfo.tickerid, "240", close, lookahead=barmerge.lookahead_off)
dHigh1 = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_off)

roll60 = ta.change(h60) != 0
roll240 = ta.change(h240) != 0
dailyBreak = close > dHigh1 and close[1] <= dHigh1[1]

if roll60 and h60 > h60[1] and h240 >= h240[1] and strategy.position_size == 0
    strategy.entry("R60", strategy.long, qty=1, comment="60 up with 240 state")

if roll240 and h240 < h240[1] and strategy.position_size > 0
    strategy.close("R60", comment="240 down close")

if dailyBreak and strategy.position_size == 0
    strategy.entry("D", strategy.long, qty=1, comment="daily high break")

if strategy.position_size > 0 and close < dHigh1 * 0.995
    strategy.close_all(comment="daily ref close")

Overview

PF probe 54 - MTF roll state fetches close prices from 60m, 240m and daily bars using request.security. Long entries trigger on a 60m roll up with flat 240m state or on a daily high breakout. Positions close on a 240m roll down or when price drops below 99.5 percent of the prior daily high. The strategy overlays signals directly on the chart with fixed size one and no stop loss. It runs on 15m ETH-USDT charts for validation purposes.

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, Breakout

Markets

Crypto

Timeframes

M15-H1

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

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 trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated today · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout
257 stars

This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos

Strategy v6 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Best Chart 1m Strategy Candle Bar

12/26-IT Strategy

by hasnocool
106 stars

This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 12/26-IT Strategy

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of 均线突破交易系统
53 stars

This strategy enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of BTCUSD 5M Optimized 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