Strategy · Pine Script v6 · On the chart

Parity Probe 01 - Stop/Limit Timing

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

This validation strategy evaluates the execution timing of stop loss and take profit orders in Pine Script.

View on GitHub

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

54 lines of Pine Script v6 from validation/analyzer-parity-stop-limit-timing-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
//
// Parity probe 01 — strategy.exit stop/limit fill-bar timing
//
// Purpose: isolate the bar-boundary semantics of strategy.exit's stop=
// and limit= orders. A community-style reverse-on-signal scalper shows a
// consistent pattern where the engine fires Exit-{long,short} ONE 15m bar
// earlier than TV across ~9 of its 14 mismatched exits (e.g. engine 18:00
// vs TV 18:15 on 2025-05-03). The hypothesis is that the engine evaluates
// the stop / limit on the SAME bar as the entry (intra-bar trigger using
// that bar's high/low), while TV defers evaluation to the NEXT bar's open
// onward. Without an isolator, the signal-side cascade in that strategy
// makes it impossible to attribute the drift.
//
// This probe routes a deterministic entry every i_period bars with an
// ATR-derived stop and limit, then lets strategy.exit handle both. No
// MTF, no signals, no regime filter — every exit row in the export is
// either a stop fill, a limit fill, or a forced flatten. Comparing the
// engine's exit timestamps against TV's row-by-row exposes the timing
// semantic directly, with no other moving parts to confound it.
//
// Trade shape: long-only, single contract, pyramiding=0,
// process_orders_on_close=false (TV default), no commission/slippage.
//
// TV setup: 15m chart on BINANCE:ETHUSDT.P, same window as
// data/ohlcv_ETH-USDT-USDT_15m.csv. Export the strategy tester's
// "List of Trades" CSV to ``tv_trades.csv`` in this folder.
//@version=6
strategy("Parity probe 01 - stop/limit timing", shorttitle="par_p01", 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=0, process_orders_on_close=false)

// ---- inputs --------------------------------------------------------
int   i_atr_len = input.int(14,  "ATR Length")
float i_stop_x  = input.float(1.0, "Stop = N x ATR", minval=0.1)
float i_tp_x    = input.float(2.0, "TP   = N x ATR", minval=0.1)

// ---- engine -------------------------------------------------------
float atr_val = ta.atr(i_atr_len)

// Wall-clock entry trigger: 00:00 and 12:00 UTC every day. We use
// the bar's UTC time (not bar_index) so engine and TV fire on the
// SAME absolute bars regardless of how many warmup bars precede
// each side's chart-bar-0. bar_index-based triggers would shift the
// firing bar by the warmup-prefix length and produce zero matches
// in `verify_corpus.py`'s align-by-time stage.
bool at_entry_window = (hour == 0 or hour == 12) and minute == 0
bool fire = at_entry_window and strategy.position_size == 0 and not na(atr_val)

if fire
    float stop_lvl = close - atr_val * i_stop_x
    float tp_lvl   = close + atr_val * i_tp_x
    strategy.entry("L", strategy.long, comment="periodic entry")
    strategy.exit("X", from_entry="L", stop=stop_lvl, limit=tp_lvl, comment_loss="stop fill", comment_profit="tp fill")

Overview

Parity Probe 01 - Stop/Limit Timing enters a single long position at fixed daily wall-clock times (00:00 and 12:00 UTC) whenever the strategy is flat. Stop loss and limit profit targets are calculated dynamically based on an Average True Range multiplier referenced from the entry bar close. It plots directly on the main price chart.

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

Volatility & bands

Markets

Any symbol

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
ATR Lengthint14i_atr_len
Stop = N x ATRfloat1.0i_stop_x
TP = N x ATRfloat2.0i_tp_x
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

330 stars

Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit

Strategy v4 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of Alert BB + RSI [Alorse]

This overlay strategy offers two selectable entry modes: a Bollinger squeeze on typical price and a simple moving-average cross. It filters trades by weekday, session, date range, and an optional news window, and can restrict direction or invert the side. Risk

Strategy v5 Volatility & bandsMoving averages
Updated today · None stated GitHub repository of Boilerplate Configurable Strategy [Yosiet]
257 stars

This overlay strategy targets one-minute ES futures and plots volume-weighted moving-average bands from the open, scaled by a standard-deviation multiple, plus a slower band from ten-minute opens. A higher-timeframe exponential moving average can filter trades

Strategy v6 Moving averagesVolatility & bands
Updated 6 weeks ago · None stated GitHub repository of ES - Futures 1M No Repaint

STRG-BBForce

by harryguiacorn
219 stars

STRG-BBForce is a Bollinger Bands trend-following strategy. It calculates standard Bollinger Bands and tracks directional alignment across the upper, lower, and basis lines. When all three lines slope upward, it opens a long position and closes short positions

Strategy v5 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of STRG-BBForce
218 stars

This strategy detects price breakouts above rolling highest highs or below lowest lows over a customizable lookback period. It includes optional volume spike and ATR volatility threshold filters, along with bar confirmation rules. Positions are taken upon conf

Strategy v6 BreakoutVolatility & bands
Updated 3 months ago · None stated GitHub repository of Breakout Strategy Template

Bollinger Breakout

by hackingthemarkets
189 stars

This price-chart strategy plots a simple moving average and upper and lower bands built from the standard deviation of close, scaled by separate offset inputs. It enters a fixed quantity long when close crosses above the upper band and a fixed quantity short w

Strategy v4 Volatility & bandsBreakout
Updated 3 years ago · None stated GitHub repository of Bollinger 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