// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe 80 - dual stop both-touch priority
//
// Purpose: isolate broker priority when both a long stop and a short stop
// entry are pending and the next bar touches both levels.
// 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 80 - dual stop priority", shorttitle="PF_P80_STOPPRIO", 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)
if hour == 2 and minute == 45 and strategy.position_size == 0
strategy.entry("LE", strategy.long, stop=close * 1.002, comment="near long stop")
strategy.entry("SE", strategy.short, stop=close * 0.998, comment="near short stop")
if strategy.position_size != 0 and hour == 6 and minute == 15
strategy.close_all(comment="morning flat")
if hour == 14 and minute == 45 and strategy.position_size == 0
strategy.entry("LE2", strategy.long, stop=close * 1.004, comment="farther long stop")
strategy.entry("SE2", strategy.short, stop=close * 0.996, comment="farther short stop")
if strategy.position_size != 0 and hour == 18 and minute == 15
strategy.close_all(comment="evening flat")