Out or Under Performance - Ratio Between Two Symbols
This Pine Script indicator computes and visualizes the price ratio between the current chart symbol (e.g., XLE) and a benchmark symbol (default: S&P 500), helping traders assess relative performance or strength.
Red line: The raw ratio (current symbol's close / benchmark's close), multiplied by a user-defined factor (default: 1.0).
Blue line: Simple moving average (SMA) of the ratio over a specified period (default: 20), smoothing the trend.
Histogram (green/red bars): Amplified difference between the ratio and its SMA (multiplied by default 5.0), showing positive (green, outperformance) or negative (red, underperformance) deviations for momentum insights.
Overlaid line on histogram (green/red/yellow): SMA of the histogram over a specified period (default: 9), colored green if rising (bullish momentum), red if falling (bearish), or yellow if flat.
Gray dashed zero line: Reference for histogram neutrality.
Overall, it highlights whether the symbol is gaining or losing ground relative to the benchmark, with the histogram and its MA emphasizing short-term shifts in that relative trend.
Pine Script®指标






















