Strategy · Pine Script v6 · Own pane

Limit Verification Probe R2

by GammaExpansion

This strategy probes limit order verification across four modes in a cycling pattern.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code58
Settings4inputs
LicenceMIT
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

58 lines of Pine Script v6 from packages/golden/fixtures/strategy/v6/S_limit_verification_marketable__2/source.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

source.pine
//@version=6
strategy("Limit verification probe r2", overlay=false, initial_capital=1000000, default_qty_type=strategy.fixed, default_qty_value=1, pyramiding=0, commission_type=strategy.commission.percent, commission_value=0, slippage=0, margin_long=0, margin_short=0, calc_on_order_fills=false, calc_on_every_tick=false, process_orders_on_close=false, backtest_fill_limits_assumption=2)

// Change "Verify price for limit orders" in Properties; keep this source intact.
mode = input.int(0, "Mode: 0 resting, 1 marketable, 2 stop-limit, 3 exit limit", minval=0, maxval=3)
offsetTicks = input.int(10, "Offset ticks", minval=1)
cycle = input.int(8, "Cycle bars", minval=4)
start = input.time(1704067200000, "Start") // 2024-01-01 00:00 UTC

var int activeIndex = -1
var float submittedLimit = na
var float submittedStop = na
var int submittedSide = 0
if time >= start
    activeIndex += 1
    phase = activeIndex % cycle
    side = int(math.floor(activeIndex / cycle)) % 2 == 0 ? 1 : -1
    if phase == 0
        strategy.cancel_all()
        strategy.close_all(comment="cycle cleanup")
        submittedLimit := na
        submittedStop := na
        submittedSide := 0
    if phase == 1
        submittedSide := side
        if mode == 0
            submittedLimit := side == 1 ? low : high
            strategy.entry("E", side == 1 ? strategy.long : strategy.short, qty=1, limit=submittedLimit)
        else if mode == 1
            submittedLimit := close + side * offsetTicks * syminfo.mintick
            strategy.entry("E", side == 1 ? strategy.long : strategy.short, qty=1, limit=submittedLimit)
        else if mode == 2
            submittedStop := close + side * offsetTicks * syminfo.mintick
            submittedLimit := close
            strategy.entry("E", side == 1 ? strategy.long : strategy.short, qty=1, limit=submittedLimit, stop=submittedStop)
        else
            submittedLimit := close + side * offsetTicks * syminfo.mintick
            strategy.entry("E", side == 1 ? strategy.long : strategy.short, qty=1)
            strategy.exit("X", "E", qty=1, limit=submittedLimit)

last = strategy.closedtrades - 1
plot(2, "probe_revision")
plot(mode, "probe_mode")
plot(bar_index, "bar_index")
plot(activeIndex, "active_index")
plot(syminfo.mintick, "mintick")
plot(submittedSide, "submitted_side")
plot(submittedLimit, "submitted_limit")
plot(submittedStop, "submitted_stop")
plot(strategy.position_size, "position_size")
plot(strategy.position_avg_price, "position_avg_price")
plot(strategy.equity, "equity")
plot(strategy.netprofit, "netprofit")
plot(strategy.closedtrades, "closed_trades")
plot(last >= 0 ? strategy.closedtrades.entry_price(last) : na, "last_entry_price")
plot(last >= 0 ? strategy.closedtrades.exit_price(last) : na, "last_exit_price")
plot(last >= 0 ? strategy.closedtrades.entry_bar_index(last) : na, "last_entry_bar")
plot(last >= 0 ? strategy.closedtrades.exit_bar_index(last) : na, "last_exit_bar")

Overview

Limit Verification Probe R2 opens positions using resting limits, marketable limits, stop-limits, or exit limits with an offset. The script runs cycles to verify order behavior and plots probe values including submitted limits, stops, position size, equity, net profit, and trade details. Main settings adjust mode, offset ticks, cycle length, and start time. It draws all plots in a separate pane for analysis.

Details

Published by

GammaExpansion on GitHub

Type

Strategy, Pine Script v6

Draws

Separate pane below the chart

Category

Screeners & dashboards, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Settings

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

SettingTypeDefaultVariable
Mode: 0 resting, 1 marketable, 2 stop-limit, 3 exit limitint0mode
Offset ticksint10offsetTicks
Cycle barsint8cycle
Starttime1704067200000start
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

FxHD Strategy v2.0

by alboogycOdR
6 stars

FxHD Strategy v2.0 is a Fibonacci multi-timeframe strategy drawn on the price chart. It reads a higher timeframe, defaulting to four hours, and sets bias with CRT kill zones, the last two candles, dynamic CRT, or market structure, plus a fallback method. It pl

Strategy v6 Support & resistanceSMC / ICT / price action
Updated 7 months ago · None stated GitHub repository of FxHD Strategy v2.0
5 stars

RG Structure is a pivot-constrained break-and-retest strategy that calculates dynamic trendlines, market structure changes, and regime states on the price chart. It identifies support and resistance lines through pivot points and evaluates break-and-retest sig

Strategy v6 TrendSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of RG Structure Visual Edition

Grid Bot [psyll]

by cullyk
2 stars

Grid Bot places a configurable number of long and short orders between a user-set grid top and bottom and draws those levels on the price chart. Direction can be longs, shorts, or both, with default or burst entry and an optional instant first fill. Exits use

Strategy v5 Mean reversionSupport & resistance
Updated 8 months ago · MIT GitHub repository of Grid Bot [psyll]

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