// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe 07 — RSI / EMA signal cross
// Purpose: parity test for ta.rsi() smoothed by ta.ema() with a 50-line gate.
//
//@version=6
strategy("RSI EMA Signal", 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 ===
rsiLen = input.int(14, "RSI Length", minval=1)
signalLen = input.int(9, "Signal EMA Length", minval=1)
// === RSI with signal line ===
rsiVal = ta.rsi(close, rsiLen)
rsiSignal = ta.ema(rsiVal, signalLen)
// === Signals ===
longCond = ta.crossover(rsiVal, rsiSignal) and rsiVal < 50
shortCond = ta.crossunder(rsiVal, rsiSignal) and rsiVal > 50
if longCond
strategy.entry("Long", strategy.long)
if shortCond
strategy.entry("Short", strategy.short)
plot(rsiVal, "RSI", color=color.blue, linewidth=2)
plot(rsiSignal, "Signal", color=color.orange)
hline(50, "Mid", color=color.gray)
hline(70, "OB", color=color.red)
hline(30, "OS", color=color.green)