// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF TA-isolate probe — RCI(14) zero-cross.
// Isolates ta.rci (Rank Correlation Index): the Spearman rank correlation
// between bar time-order and price ranks, scaled x100. The engine computes
// rho via the d^2 shortcut (1 - 6*sum(d^2)/(n*(n^2-1))), which is only exact
// when there are NO tied prices in the window. On ties TV may instead use
// Pearson correlation on average-ranks (the tie-correct form). This probe
// drives entries purely off the sign of RCI so any d^2-vs-Pearson-on-ties
// divergence surfaces as a trade-count / fill-price drift that only a TV
// export can adjudicate.
//@version=6
strategy("PF TA isolate - RCI(14) zero cross", shorttitle="TAI_RCI",
overlay=false, 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)
rci = ta.rci(close, 14)
if ta.crossover(rci, 0)
strategy.entry("L", strategy.long, comment="rci cross up")
if ta.crossunder(rci, 0)
strategy.entry("S", strategy.short, comment="rci cross dn")