Strategy · Pine Script v6 · On the chart

PF Probe 98 - Inside-Bar Engulf

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

PF Probe 98 - Inside-Bar Engulf is a strategy that detects single-bar inside range patterns paired with candle direction filters.

View on GitHub

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

48 lines of Pine Script v6 from validation/ta-inside-bar-engulfing-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 98 — inside-bar engulfing entries
// Clean-room: written from validation goal, not from source.
//
// Purpose: exercises the simplest relational price-pattern surface — a
// 1-bar inside-range gate (`high < high[1] and low > low[1]`) plus the
// candle-direction tiebreaker (`close > open` vs `close < open`). Every
// term references the prior bar via the `[1]` history operator on raw
// OHLC series, so any engine that mishandles the boundary between
// "current-bar value" and "prior-bar value" — or that resolves OHLC
// history with a different lag than TradingView — will desync trade
// timestamps here.
//
// Validation goal: bit-exact trade list against TradingView's broker
// emulator on the reference 15m feed. Pass = every long/short entry
// fires on the same bar TradingView places it.
//
// TV setup: 15m chart, ETH-USDT-USDT (Binance USDT-M Perpetual). Full
// window matching corpus/data/ohlcv_ETH-USDT-USDT_15m.csv. Strategy
// properties: leave defaults from script header. Export "List of
// trades" → tv_trades.csv.
//@version=6
strategy("PF probe 98 - inside-bar engulf", shorttitle="PF_p98_INBAR",
     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)

// ---- inside-bar relational pattern ---------------------------------
bool inside_bar = high < high[1] and low > low[1]

// ---- candle-direction tiebreaker -----------------------------------
bool bull_inside = inside_bar and close > open
bool bear_inside = inside_bar and close < open

// ---- entries on next bar's open ------------------------------------
if bull_inside and strategy.position_size <= 0
    if strategy.position_size < 0
        strategy.close("S", comment="flip flat")
    strategy.entry("L", strategy.long, comment="bull inside-bar")

if bear_inside and strategy.position_size >= 0
    if strategy.position_size > 0
        strategy.close("L", comment="flip flat")
    strategy.entry("S", strategy.short, comment="bear inside-bar")

Overview

PF Probe 98 - Inside-Bar Engulf identifies inside bars where the high is lower than the previous high and the low is higher than the previous low. A long entry triggers when an inside bar closes bullish, while a short entry triggers when an inside bar closes bearish. Existing opposing positions are closed before entering a new direction. Plotted on the main price chart, the strategy operates without configurable inputs or exit stop losses.

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

Candlestick patterns

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

330 stars

Exceeded Candle [Alorse] is a mean-reversion strategy that identifies candlestick engulfing patterns combined with Bollinger Bands filters. It enters a long position when a green candle surpasses the body of the previous red candle while price is below the mid

Strategy v4 Mean reversionCandlestick patterns
Updated 2 months ago · None stated GitHub repository of Exceeded candle [Alorse]
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

Strategy v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Strategy

ESU2023-10M - V1

by dearvn
257 stars

ESU2023-10M - V1 is an intraday trend-reversal strategy designed for index futures contracts on the price chart. It calculates a 3-period moving average of candle highs and lows alongside specific three-bar price action patterns to detect short-term swing high

Strategy v5 TrendCandlestick patterns
Updated 6 weeks ago · None stated GitHub repository of ESU2023-10M - V1

STRG One Bar Pursuit

by harryguiacorn
219 stars

The STRG One Bar Pursuit strategy identifies single-bar momentum reversals by monitoring shifts between bullish and bearish candlesticks starting from the year 2024. It enters a long position when a bullish candle follows a bearish candle and enters a short po

Strategy v5 Candlestick patternsMean reversion
Updated 1 year ago · None stated GitHub repository of STRG One Bar Pursuit
218 stars

This strategy identifies trade opportunities based on candlestick wick imbalances relative to the Average True Range. It enters positions when candle wicks exceed defined thresholds and filters out doji candles using a minimum body ATR requirement. Exits are h

Strategy v6 Candlestick patternsVolatility & bands Repaints
Updated 3 months ago · None stated GitHub repository of Super Negative R:R Wick 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