Strategy · Pine Script v6 · On the chart

PF Analyzer (PineForge)

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

PF Analyzer (PineForge) is a multi-mode validation strategy designed to benchmark trade execution timing and parity against backtesting engines.

View on GitHub

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

80 lines of Pine Script v6 from validation/analyzer-self-test-multi-mode-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 pineforge-analyzer — multi-mode parity exporter
// Purpose: parity test for a single strategy that switches among four entry
// shapes (clock_pulse / htf_60_roll / htf_d_high1 / bar_stair) via an
// input.string mode selector, used to spot-check engine timing per-shape.
//
// PineForge analyzer — run on the SAME symbol + timeframe + date range as repo OHLCV.
// Export List of trades → compare with scripts/diff_tv_vs_engine.py or validate_detailed_report.py
//
// Multiple mode exports: name files trades-<mode>.csv and set inputs.json "Analysis mode" +
// "tv_trades_csv" to match, OR run: uv run python scripts/diff_pineforge_analyzer_modes.py
//
// Modes (input):
//   clock_pulse — periodic 1-bar long trades (bar index + timestamp ruler vs engine)
//   htf_60_roll   — ta.change(D-60 close) entries (HTF close alignment)
//   htf_d_high1   — daily high[1] break (request.security + series[1] gate; same class as mtf-probe-04)
//   bar_stair     — close > close[1] > close[2] (Series [k] chain smoke test)
//
// Chart: match PineForge input_tf (e.g. 15m for ETHUSDT 15m CSV). Commission/slippage 0.
// TV “List of trades” naive times: if you export with chart/sessions in UTC+8, set inputs.json
// tv_trades_csv_tz to "utc_plus_8" (repo default for parity tooling).
//
// clock_pulse: UTC 00:15 entry / 00:30 exit (15m) — aligns with TV labels 08:15/08:30 when
// tv_trades_csv_tz is utc_plus_8. PineForge engine still defers bare MARKET fills one bar when
// process_orders_on_close=false, so trade timestamps/prices vs TV CSV need same-bar fill fix in
// runtime for full pairwise parity.
//@version=6
strategy("PF Analyzer (PineForge)", shorttitle="PF_analyze", 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)

mode = input.string("clock_pulse", "Analysis mode",
     options = ["clock_pulse", "htf_60_roll", "htf_d_high1", "bar_stair"])
// Legacy input kept for saved layouts; clock_pulse ignores it (was bar_index % stepBars).
stepBars = input.int(96, "clock_pulse: unused (legacy bar step)", minval = 2)

// --- clock_pulse: long 00:15 UTC bar, exit 00:30 UTC (15m chart); skip first bar ---
inPulse = bar_index > 0 and hour == 0 and minute == 15
exitPulse = bar_index > 0 and hour == 0 and minute == 30

// --- htf_60_roll ---
h60 = request.security(syminfo.tickerid, "60", close, lookahead=barmerge.lookahead_off)
roll60 = ta.change(h60) != 0

// --- htf_d_high1 (same logic family as validation/mtf-probe-04-daily-prev-high) ---
dH1 = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_off)
crossUp = close > dH1 and close[1] <= dH1[1]
exitD = close < dH1 * 0.995 and strategy.position_size > 0

// --- bar_stair ---
stair = close > close[1] and close[1] > close[2]

if mode == "clock_pulse"
    if exitPulse
        strategy.close("C")
    if inPulse
        strategy.entry("C", strategy.long, qty=1)

if mode == "htf_60_roll"
    if roll60 and strategy.position_size == 0
        strategy.entry("R", strategy.long, qty=1)
    if roll60[1] and strategy.position_size != 0
        strategy.close("R")

if mode == "htf_d_high1"
    if crossUp and strategy.position_size == 0
        strategy.entry("L", strategy.long, qty=1)
    if exitD
        strategy.close("L")

if mode == "bar_stair"
    if stair and strategy.position_size == 0
        strategy.entry("S", strategy.long, qty=1)
    if not stair and strategy.position_size > 0
        strategy.close("S")

Overview

PF Analyzer (PineForge) provides four selectable operational modes: a clock pulse for fixed intraday time entries and exits, a 60-minute higher-timeframe roll trigger, a breakout above the prior daily high, and a consecutive rising close pattern. The strategy executes long entries directly on the price chart. Built primarily as an engine parity test harness, it lacks hard stop losses across most modes and requires specific timeframe alignment.

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

Sessions & time, Breakout

Markets

Any symbol

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
Analysis modestringclock_pulsemode
clock_pulse: unused (legacy bar step)int96stepBars
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

106 stars

This script monitors opening gap conditions and breakout behavior relative to the first candle's range across up to twenty configurable stock tickers. It detects whether following bars remain inside the opening range before breaking out, displaying the status

Strategy v4 Screeners & dashboardsBreakout Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 1St Bar GAP+BkOut Screener v2 by RM
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

Turtle MACD Time-Zone Filter

by skywalker0803r
42 stars

This strategy enters long when price closes above the prior Donchian high and short when it closes below the prior Donchian low, only while flat and inside a Taipei-hour window. It exits on a MACD histogram reversal or through an ATR stop and a percentage take

Strategy v5 BreakoutOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Turtle MACD Time-Zone Filter
39 stars

This intraday strategy implements Mark Fisher's Opening Range Breakout (ORB) methodology tailored for index futures like ES and NQ. It calculates session opening ranges, volume z-scores, and VWAP bands to plot support, resistance, and confirmation levels on th

Strategy v6 BreakoutSessions & time Repaints
Updated 4 days ago · MIT GitHub repository of Futures Intraday Pro (ES/NQ) Strategy

Morning Scalp

by benso87
24 stars

This strategy tracks an opening session time range to establish directional bias and triggers pullback trades using Stochastic RSI. Once price breaks out of the initial range, it establishes a directional bias and enters when the Stochastic RSI crosses over in

Strategy v5 Sessions & timeBreakout
Updated 4 years ago · MPL-2.0 GitHub repository of Morning Scalp
23 stars

This strategy evaluates breakout and trend opportunities on the price chart using a weighted composite score of volume, trend, and candlestick structure. It tracks volume spikes, fast and slow EMAs, higher-timeframe EMA trend alignment, opening ranges, and ses

Strategy v6 TrendVolume Repaints
Updated 3 weeks ago · Custom licence GitHub repository of TradingAlpha Point-Clip 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