// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe 51 - trail_points with trail_offset
//
// Purpose: isolate TradingView semantics for the legal trailing-stop pair
// trail_points + trail_offset without stop/limit siblings.
// 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 51 - trail points offset", shorttitle="PF_P51_TRAIL", 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)
trailPts = input.float(80.0, "Trail Points", minval=1.0)
trailOff = input.float(40.0, "Trail Offset", minval=1.0)
if hour == 9 and minute == 15 and strategy.position_size == 0
strategy.entry("L", strategy.long, qty=1, comment="trail long")
if hour == 15 and minute == 15 and strategy.position_size == 0
strategy.entry("S", strategy.short, qty=1, comment="trail short")
if strategy.position_size > 0
strategy.exit("LX", "L", trail_points=trailPts, trail_offset=trailOff, comment="trail long")
if strategy.position_size < 0
strategy.exit("SX", "S", trail_points=trailPts, trail_offset=trailOff, comment="trail short")
if strategy.position_size != 0 and hour == 23 and minute == 45
strategy.close_all(comment="timeout")