// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe 50 - stop/limit/trail same-bar exit
//
// Purpose: isolate one strategy.exit carrying stop, limit, and trail_points at
// the same time. This is the exit surface used by the scalping integration
// probe family.
// 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 50 - stop limit trail", shorttitle="PF_P50_EXIT3", 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)
atr = ta.atr(14)
enterLong = hour == 8 and minute == 15 and strategy.position_size == 0
enterShort = hour == 16 and minute == 15 and strategy.position_size == 0
if enterLong
strategy.entry("L", strategy.long, qty=1, comment="probe long")
if enterShort
strategy.entry("S", strategy.short, qty=1, comment="probe short")
if strategy.position_size > 0
longStop = strategy.position_avg_price - atr * 0.8
longLimit = strategy.position_avg_price + atr * 1.6
strategy.exit("LX", "L", stop=longStop, limit=longLimit, trail_points=atr, comment="triple exit long")
if strategy.position_size < 0
shortStop = strategy.position_avg_price + atr * 0.8
shortLimit = strategy.position_avg_price - atr * 1.6
strategy.exit("SX", "S", stop=shortStop, limit=shortLimit, trail_points=atr, comment="triple exit short")
if strategy.position_size != 0 and hour == 23 and minute == 45
strategy.close_all(comment="timeout")