// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe 15 — momentum + ROC zero-cross combo
// Purpose: parity test for ta.mom() and ta.roc() (price-difference indicators
// rather than smoothings) with paired zero-cross + sign-confirm entries.
//
//@version=6
strategy("Momentum ROC Combo", overlay=false, initial_capital=1000000, process_orders_on_close=false, pyramiding=1, commission_type=strategy.commission.percent, commission_value=0, slippage=0, default_qty_type=strategy.fixed, default_qty_value=1)
// === Inputs ===
momLen = input.int(10, "Momentum Length", minval=1)
rocLen = input.int(10, "ROC Length", minval=1)
// === Momentum & ROC ===
momVal = ta.mom(close, momLen)
rocVal = ta.roc(close, rocLen)
// === Signals: both cross zero together ===
longCond = ta.crossover(momVal, 0) and rocVal > 0
shortCond = ta.crossunder(momVal, 0) and rocVal < 0
// === Strategy ===
if longCond
strategy.entry("Long", strategy.long)
if shortCond
strategy.entry("Short", strategy.short)
// Exit when momentum fades
if strategy.position_size > 0 and momVal < 0
strategy.close("Long")
if strategy.position_size < 0 and momVal > 0
strategy.close("Short")
plot(momVal, "Momentum", color=color.blue)
plot(rocVal, "ROC", color=color.green)
hline(0, "Zero")