// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF TV golden 44 - raw strategy.order OCA reduce
//
// Purpose: isolate strategy.order exits with shared oca_name and strategy.oca.reduce.
// 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 TV golden 44 - OCA reduce", shorttitle="PF_G44_OCA", 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 == 7 and minute == 15 and strategy.position_size == 0
strategy.entry("L", strategy.long, qty=1, comment="oca source")
if strategy.position_size > 0
qty = math.abs(strategy.position_size)
entry = strategy.position_avg_price
strategy.order("TP", strategy.short, qty=qty, limit=entry * 1.004,
oca_name="BRACKET", oca_type=strategy.oca.reduce)
strategy.order("SL", strategy.short, qty=qty, stop=entry * 0.996,
oca_name="BRACKET", oca_type=strategy.oca.reduce)
if strategy.position_size == 0
strategy.cancel("TP")
strategy.cancel("SL")
if strategy.position_size > 0 and hour == 13 and minute == 15
strategy.close("L", comment="timeout")