OPEN-SOURCE SCRIPT

Kairi Relative Index Upgrated v1

50
Kairi Relative Index Upgraded v1 [JopAlgo] — how far from “fair” are we, right now?

Most oscillators mash together price and momentum in ways that are hard to explain to a new trader. KRI is refreshingly simple: it measures how far price is from its moving average, as a percent of that average.

KRI = 100 × (Price − SMA) / SMA
Above 0 → price is above its average (stretched up).
Below 0 → price is below its average (stretched down).
The farther from 0, the more stretched we are from the mean.

This upgraded version keeps the pane clean (zero line, colored KRI, optional guide rails at +Line Above / Line Below) so you can read extension, reversion pressure, and reclaims at a glance—on any timeframe.

(If you add screenshots: image #1 should label the zero line and ± threshold lines; image #2 should show a textbook “overshoot at VAH/VAL + KRI extreme → rotate back to POC.”)

What you’re seeing (and how to read it fast)

KRI line

Green when KRI ≥ 0 (price above SMA)

Red when KRI < 0 (price below SMA)

Zero line = the moving average itself (no stretch).

Guide lines (default +10/−10) = “This is pretty far for this setting.” Treat these as review-and-decide zones, not auto-trade signals.

Three quick reads:

Magnitude: how far from the mean (size of KRI).

Direction: above/below zero (which side of the mean).

Turn: KRI curling back toward zero (reversion starting) or accelerating away (trend impulse continuing).

What KRI really measures (plain-English)

The SMA(length) is your “fair value” line for this indicator.

KRI tells you the percentage deviation from that fair value—normalized, so you can compare across assets/timeframes with the same length.

Because it’s a pure distance metric, KRI excels at:

spotting over-extensions into VP edges (VAH/VAL) and AVWAP,

timing mean-reversion back to POC/AVWAP in balance,

confirming reclaims (KRI crossing back through zero at a level),

framing pullbacks in trend (healthy dips usually avoid deep negative KRI in strong uptrends).

Using KRI on any timeframe

The workflow is always Location → Flow → KRI:

Location: a real level (Volume Profile v3.2’s VAH/VAL/POC/LVNs or Anchored VWAP).

Flow quality: check CVDv1 (Alignment OK? Absorption not red?).

KRI: are we stretched into/away from the level, and is KRI turning?

Scalping (1–5m)

Fade the stretch (balance): At VAH/VAL or Session AVWAP, an extreme KRI that rolls back toward zero = quick rotation to the middle (POC/AVWAP).

Don’t fade if bands are expanding and flow is strong (CVDv1 says go) — big KRI can stay big in expansion.

Intraday (15m–1H)

Continuation after pullback: In uptrends, look for shallow negative KRI at support (VAL/AVWAP) that turns up → join trend.

Failed breakout tell: Price pokes above VAH but KRI barely increases or rolls over quickly → likely a reclaim back inside value.

Swing (2H–4H)

Edge-to-mean rotations: At composite VAH/VAL, KRI extremes are great context: fade back to POC/HVNs if flow doesn’t confirm a breakout.

Reclaim confirmation: After a flush below Weekly AVWAP, KRI crossing back up through zero on the reclaim bar is a clean green light.

Position (1D–1W)

Regime posture: Multi-day runs with sustained positive KRI (and shallow dips) = constructive; mirror for downtrends. Use KRI pullbacks to ~0 at Weekly AVWAP for adds.

Entries, exits, and risk (simple rules)

Mean-reversion entry: At VAH/VAL or AVWAP, wait for KRI extreme at/through your guide line and a turn back toward zero.

Stop: just beyond the level; Target: POC/HVN or the zero line on KRI.

Trend-continuation entry: In a trend, take pullbacks where KRI stays modest (doesn’t blow through your lower/upper guide) and turns back with the trend at the level.

Avoid: chasing breakouts where KRI is already extreme and still climbing unless CVDv1 says Alignment OK + no Absorption and you have a clean retest.

Settings that matter (and how to tune them)

Length (default 50): defines the moving average “fair value.”

Shorter (20–34): faster, more signals, more noise—good for intraday.

Longer (50–100): steadier, better for swings/position.

Source (default close): keep it simple; hlc3 or close both work.

Line Above / Below (defaults +10/−10): your review zones. Tune them to the asset/timeframe:

Scroll back 6–12 months and eyeball typical |KRI| spikes. Set your lines around the 80th–90th percentile of |KRI| for that market and length.

Majors often need smaller thresholds than thin alts on the same timeframe.

Tip: If your KRI is always beyond the lines, increase length or widen the thresholds. If it never touches them, shorten length or tighten thresholds.

What to look for (pattern cheat sheet)

Stretch into level → curl: KRI tags an extreme right at VAH/VAL/AVWAP, then turns back → classic rotation.

Shallow pullback in trend: KRI dips toward zero but doesn’t hit your lower guide, then turns up at support → continuation.

No-juice break: New price high with weaker KRI (smaller positive % vs prior leg) → breakout lacks extension; plan for retest or reclaim.

Zero-line reclaims: After a washout, KRI crosses zero as price reclaims AVWAP/VAL → clean confirmation.

Combining KRI with other [JopAlgo] tools

Cumulative Volume Delta v1 (CVDv1):

Use KRI for stretch/turn, CVDv1 for quality.

A KRI extreme at VAH with CVDv1 Absorption (red) is a do-not-chase; look for the fail/reclaim.

A KRI pullback toward zero at VAL with Alignment OK + strong Imbalance + no Absorption = high-quality continuation.

Volume Profile v3.2:

KRI’s best signals happen at VAH/VAL/POC/LVNs.

LVN traversals with rising KRI often run quickly to the next HVN—use VP for targets.

Anchored VWAP [JopAlgo]:

Treat AVWAP as fair-value rails. KRI zero cross on an AVWAP reclaim is your green flag; KRI extreme + failure to accept beyond AVWAP warns of a fake break.

Common pitfalls KRI helps you avoid

Buying high into a tired move: KRI already very positive at VAH and rolling over = likely rotation; wait.

Fading true expansion: In strong trends with confirmed flow, KRI can remain extreme; don’t automatically fade just because it’s “far.”

Wrong thresholds: Copy-pasting ±10 to every market/timeframe can mislead. Calibrate to the market you trade.

Practical defaults to start with

Length: 50

Lines: +10 / −10 as placeholders—calibrate later.

Timeframes: great out of the box on 15m–4H; for 1–5m try Length 34 and tighter lines; for daily swings try Length 100 and broader lines.

Process: Level → CVDv1 quality → KRI stretch/turn. If any of the three disagree, wait for the retest.

Disclaimer & Licensing

This indicator and its description are provided for educational purposes only and do not constitute financial or investment advice. Trading involves risk, including the possible loss of capital. [JopAlgo] makes no warranties and assumes no responsibility for any decisions or outcomes resulting from the use of this script. Past performance is not indicative of future results. Use at your own risk.

Licensing & Attribution:
Copyright (c) 2018–present, Alex Orekhov (everget). Modified and upgraded by [JopAlgo].
The original “Kairi Relative Index” is released under the MIT License, and this derivative is distributed under the MIT License as well. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files to deal in the Software without restriction, subject to the conditions of the MIT License, including the above copyright notice and this permission notice. The Software is provided “AS IS,” without warranty of any kind, express or implied.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.