TradingView Scripts

RSI Memory Attribution – Relative Strength Index | TradingView Free Indicator

RSI Memory Attribution – Relative Strength Index Guide | SG Group
Skip to content
Japanese page

FreeOpen sourcePine Script v6

TradingView Free Indicator

The same RSI reading can have different histories behind it. Keep native RSI intact while separating recent and older contributions, testing single-term dependence and inspecting sensitivity to the ordering of changes.

RSI / Attribution and Sensitivity
Real chart published on TradingView: RSI Memory Attribution - Relative Strength Index
Real chart image from the published TradingView page. The symbol, timeframe, settings and prices shown are a captured example, not current data or a trading result.
PurposeSeparate RSI level from its composition, weighting and sensitivity
Best forUsers examining RSI extremes and the historical contributions behind the number
Primary outputNative RSI, contribution ribbon, removal range, order/concentration and research pages
Chart placementSeparate oscillator pane below price
01 — Overview

Read the familiar 0–100 value together with its composition

The tool studies the smoothed gains and losses underlying TradingView’s built-in RSI without replacing the formula. It does not average RSI lengths, detect price/RSI divergence or combine unrelated signals into a score. It is descriptive oscillator research, not a forecast.

What it visualizes

Cyan is native RSI; violet is 50 plus older contribution. Mint/orange ribbon adds/subtracts recent RSI points. Gold REMOVE ONE includes actual RSI and single-removal candidates. Pink ORDER RANGE gives snapshot order bounds in the readout, not a future projection. Six pages share a five-row readout.

How it works

Let N be RSI length, q=1−1/N and T=G+L for Wilder-smoothed gains and losses. Multiply G/L from H bars ago by q^H to obtain older components, subtract them from current G/L for recent components, and normalize both with the same current T.

An additive RSI identity

Recent R=50×(recent gains−recent losses)/T; older O=50×(older gains−older losses)/T; RSI=50+R+O. For example −4.53 and −10.87 yield 34.60, subject to display rounding. The violet 50+O base is not an independently calculated older-window RSI.

Remove exactly one term

Full REMOVE ONE tests ages 0…H−1, subtracting one weighted contribution while preserving every other weight. It does not delete a candle and reconnect prices. Removing a gain cannot raise RSI; removing a loss cannot lower it. The largest eligible gain/loss terms provide the extremes, with actual RSI included.

Change order, not membership

ORDER RANGE fixes the older state and retains all signed recent changes, changing only recency-weight assignments. Sorting signed changes against descending weights and reversing that arrangement gives the bounds without enumerating permutations. Start/end source values stay fixed, but intermediate rearranged paths need not be economically feasible.

Equal-weight baseline and position

ORDER EFFECT compares actual RSI with equal allocation of total recent weight across H changes. Because RSI is nonlinear, this is not mean RSI over random permutations. POS is the actual value’s 0–100 location inside the range, not a percentile/probability; zero width has no defined position.

Concentration and age

For recent term movement m=absolute source change×RSI weight, EQ=(sum m)^2/sum(m^2). Near 1 means concentration in few terms; nearH means more even contributions. AGE is the movement-weighted mean age, newest 0. TOP is the largest term’s share of recent movement, not all RSI memory.

Completed extreme episodes

A sequence of confirmed same-side extreme readings has duration in bars and area A in RSI-point bars beyond its threshold. Completed upper/lower pools are separate. Current age/area ranks use same-side completions with half-weight ties. Defaults retain 60 per side and need 20 for summaries.

02 — Install and start

Add it to TradingView

Start with standard candles, Close, RSI length 14, H 7 and 70/30 thresholds. Read RSI and MEMORY first. H partitions an existing RSI state; it is not a second oscillator length.

RSI Memory Attribution – Relative Strength Index

Open the public RSI Memory Attribution – Relative Strength Index page and add it to TradingView. No SG Group registration is required.

  1. Open the “Use on TradingView” link below.
  2. Select “Use on chart” on TradingView to add the script to your chart.
  3. Open the gear icon, then Settings → Inputs, and observe the default configuration first.
  4. Change one input at a time for the symbol and timeframe you are studying.
Observe the defaults firstChange one input at a timeVerify symbol, timeframe and feed

Prevent misreads when indicators overlap

Overlapping lines, bands, backgrounds or tables can be duplicate drawings of the same kind of information. Never treat visual overlap by itself as stronger evidence or signal agreement. Native RSI, older base, contribution ribbon and removal shading are different views of one RSI state, not independent confirmations.

  • Use a separate pane; match source, N and open-bar hold when comparing another RSI.
  • Toggle ribbon and removal shading separately to identify their roles.
  • Circles indicate classification sensitivity, squares indicate width events. Circle priority does not cancel the square’s alert condition.
  • The strip near 98 is categorical, not an RSI reading. Separate readouts and check Legend and page names.
03 — How to read it

A practical reading order

Use Overview, Order and concentration, Episodes, Entry study and Diagnostics to answer different questions. Check the candidate set, sample scope and information time on each page.

Read level and contribution

Defaults classify ≥70 as UPPER, ≤30 as LOWER, otherwise IN RANGE. MEMORY R/O are recent/older contributions in RSI points. Check agreement or opposition, not fundamental overvaluation or undervaluation.

Interpret the removal asterisk

An asterisk means some candidate changes threshold classification. An actual 34.6 and range 28.6–38.5 can cross the lower 30 threshold under removal. This is not a forecast that RSI or price will go there; no asterisk does not certify a trade.

Keep snapshot analysis in its own time

Order, concentration and direct-scan diagnostics describe only the latest displayed snapshot. Moving the cursor does not reconstruct those historical values; they are not copied backward or used to assign past entry groups. A gain/loss side without movement has no defined separate age.

Exclude interrupted or unobserved starts

An episode marked+ was already active when valid sampling began and is excluded from completed pools. Missing/invalid observations and date boundaries interrupt rather than complete episodes. Active ranks are not remaining-duration or reversal-odds estimates.

Fix the triggering term for entry research

Entry means entering an RSI threshold region, not opening a trade. Hold age 0 fixed and test removal of ages 1…H−1. PRIOR-RESILIENT means none changes entry classification; PRIOR-SENSITIVE means at least one does. Assign the label at entry before outcomes, without interpreting it as price resilience.

Separate END from RUN

At default K 5, E/END tests the endpoint’s same extreme side; R/RUN requires all K subsequent closes including the endpoint on that side. Leaving and returning can satisfy END alone. R here means RUN, unlike MEMORY R. POOLED BASELINE combines the same selected/classified/matured observations, not an independent control.

Check P/D/X/O and counts

P is accepted but pending. D is a matured window with missing/invalid/out-of-date observations. X is unclassifiable prior removal, unstable residual or numeric boundary ambiguity. O is a classifiable entry excluded by non-overlap. These are not observed failures. Counts accumulate through eligible loaded history independently of the 60-episode cap.

Read diagnostics without over-certifying

Diagnostics checks RSI identity, direct recent sums, full/prior removal comparisons and whether sorted bounds contain actual RSI. Errors show nine decimals with tolerance 0.000001 in stated units. These are latest-snapshot checks, not all-history certification; n/a is not a pass.

Status and display terms

UPPER / IN RANGE / LOWER

At/above upper threshold / between thresholds / at/below lower; defaults 70/30.

MEMORY R / O

Recent/older contributions. RSI=50+R+O; R here is not RUN.

REMOVE ONE / *

Single-term removal range including age 0; asterisk means a classification-changing candidate exists.

ORDER RANGE / ORDER EFFECT / POS

Order bounds / difference from equal-weight baseline / range position, not probability.

EQ / AGE / TOP

Equivalent equal-contribution count / weighted mean age / largest share within recent movement.

PRIOR-RESILIENT / PRIOR-SENSITIVE

No prior-term deletion changes entry class / at least one does; not future price resilience.

E / END; R / RUN

Same-side extreme at endpoint / at every subsequent close through K.

P / D / X / O

Pending / invalid matured window / unclassifiable / overlap exclusion; not failures.

Episode + / A

Unobserved-start episode / accumulated excess area. Plus-marked episodes are excluded from completed pools.

Strip at 98

Mint: both materially positive; orange: both negative; gold: opposition; violet: one material cohort; grey: small/mixed.

n/a

Unavailable due to readiness, candidates or denominator stability; not pass, resilience or failure.

04 — Settings reference

Settings reference

The labels below match the published script’s English Inputs panel. Defaults reflect the public source at the time of review and may change in a later TradingView update.

On small screens, each input is reformatted as a readable stacked card.

01 | RSI

7 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Sourceclose / options: open, high, low, close, hl2, hlc3, hlcc4, ohlc4Calculation source. Close matches standard close-based RSI; alternatives include open/high/low and OHLC averages. An external indicator source can repaint upstream.
RSI length14 / min 2, max 300RSI length N, default 14, range 2–300. Distinct from attribution horizon H.
Upper threshold70 / min 50.1, max 99.9Upper threshold, default 70, inclusive. UPPER is an oscillator classification, not valuation or a sell order.
Lower threshold30 / min 0.1, max 49.9Lower threshold, default 30, inclusive. LOWER is not a valuation or buy instruction.
Enable research / off = native RSI onlyOnEnables research; off leaves the native RSI alone.
Hold last closed reading on the open barOnHolds the last closed reading on the open bar only, without shifting historical plots. Off allows intrabar changes; episodes, entry research and alerts remain close-confirmed.
Research settling: RSI lengths10 / min 2, max 15Settling requires N times this setting plus H consecutive valid changes: 147 by default, possibly already loaded. It reduces initialization influence without proving infinite-history convergence; native RSI is not held back.

02 | Attribution and sensitivity

5 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Recent cohort: H changes7 / min 1, max 200Recent cohort H, default seven. Attribution/full removal uses ages 0…H−1; entry research excludes age 0 and requires H≥2. Age 0 is the displayed observation.
Material contribution: RSI points2 / min 0.1, max 20Material contribution threshold, default two RSI points, for cohort-state classification rather than the RSI formula.
Single-term removal analysisOnEnables REMOVE ONE, deleting one recent weighted term per candidate, not all H terms at once.
Latest order / concentration analysisOnEnables latest-snapshot order and concentration analysis, not cursor-driven historical readings.
Wide-range marker threshold: RSI points3 / min 0.1, max 50Removal-width threshold for the width event, default three RSI points, separate from material contribution.

03 | Confirmed research

10 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Completed extreme episodesOnEnables completed same-side extreme-episode research. Active and unobserved-start episodes are not completed samples.
Episode completions retained per side60 / min 10, max 300Retained completed episodes per side, default 60. It does not cap entry-study counts.
Minimum observations for a summary20 / min 3, max 100Minimum observations for summaries, default 20. Affected summaries/rates can be withheld while counts remain visible; not a significance test.
Entry study: prior terms onlyOnAt entry, fixes the triggering age 0 change and tests deleting ages 1…H−1. Classification is frozen before outcomes and differs from full REMOVE ONE.
Outcome horizon: K closes after entry5 / min 1, max 200Outcome horizon K after accepted threshold entry, default five closes. Tests endpoint and every-close persistence, not a trade holding period.
Non-overlapping entry windowsOnAccepts the earliest classifiable entry across both sides, then skips entries through its +K bar inclusive. Selection is outcome-blind; non-overlap is not independence.
Entry-study sideUpper / options: Upper, LowerSelects the displayed entry-study side: Upper by default, or Lower.
Restrict research by bar close timeOffFilters research observations by bar close time; does not reset RSI initialization or load missing history.
Sample start2020-01-01 00:00 UTCSample start, default 2020-01-01 00:00 UTC, used when date restriction is enabled.
Sample end2099-12-31 23:59 UTCSample end, default 2099-12-31 23:59 UTC. Partial episodes and incomplete/invalid outcome windows are not completed observations.

04 | Appearance

13 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Memory base and signed ribbonOnShows older base 50+O and the signed recent-contribution ribbon to RSI. The base is not a separate older-window RSI.
Single-term removal shadingOnShades the full-removal range, including actual RSI, in gold. Not a volatility band or confidence interval.
Also draw removal edgesOffAdds removal-range edge lines; off by default.
Cohort strip at 98 / see LegendOffShows a categorical cohort strip near 98, off by default. It is not another RSI reading; consult Legend.
Confirmed event markersOff / options: Off, Classification circles, Width squares, BothOff, classification circles, width squares or Both. Circles mark new full-test sensitivity; squares mark width-threshold crossings. Circles win drawing priority when simultaneous; separate alerts remain.
Subtle RSI haloOnAdds a subtle halo around the RSI line.
RSI line width3 / min 1, max 5RSI line width, default three.
Memory ribbon transparency83 / min 50, max 98Memory-ribbon transparency, default 83; higher is fainter.
Removal shading transparency89 / min 70, max 98Removal-shading transparency, default 89.
Compact five-row readoutOnShows the compact five-row readout.
Readout pageOverview / options: Overview, Order and concentration, Episodes, Entry study, Diagnostics, LegendSelects Overview, Order and concentration, Episodes, Entry study, Diagnostics or Legend.
Readout positionTop right / options: Top right, Bottom right, Top left, Bottom leftReadout position: top/bottom right or top/bottom left.
Readout font size13 / min 10, max 18Readout font size, default 13, range 10–18.

05 | Colors

9 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
RSI#40E9FFNative RSI line color, cyan by default.
Positive contribution#42F5BDPositive recent-contribution color, mint by default; not a buy signal.
Negative contribution#FF985ANegative recent-contribution color, orange by default; not a sell signal.
Older contribution base#B59AFFOlder-contribution base color, violet by default.
Removal sensitivity#FFDA62Removal-sensitivity color, gold by default.
Order analysis / width squares#FF81D0Order-analysis and width-square color, pink by default.
References and secondary text#98A6B9Reference and secondary-text color, blue-grey by default.
Readout background#111A29Readout background color.
Readout foreground#F1F7FFReadout foreground color.
05 — Alerts

Seven close-confirmed alert conditions

Create each required alert in TradingView. Native threshold alerts are independent of research date filters. Drawing priority does not merge the distinct conditions.

  • RSI entered upper threshold — New upper-region entry.
  • RSI entered lower threshold — New lower-region entry.
  • RSI left upper threshold — Exit from the upper region.
  • RSI left lower threshold — Exit from the lower region.
  • Recent and older contributions opposed — Recent and older contributions materially oppose.
  • All-term removal classification changed — New full-removal sensitivity, including age 0; not the prior-only entry-study label.
  • All-term removal range widened — Full-removal width crosses its configured RSI-point threshold.
06 — Limitations and responsible use

Not a buy/sell signal

This tool is for analysis and visualization. It is not investment advice, a trade recommendation, a forecast, or a promise of profit or accuracy. Results depend on inputs, symbol, timeframe, and data feed. You remain responsible for every trading decision.

Candidate sets answer different questions

Removing the triggering age 0 at a fresh crossing restores the previous RSI ratio, making every evaluable entry structurally sensitive. Prior-only research avoids that problem, but either group may still be sparse or empty. Do not reuse the full-test asterisk as the entry-group label.

Unavailable does not mean resilient

No nonzero candidate or an unstable residual denominator produces n/a. A zero-width order range can be valid while POS is undefined. Unavailability is not evidence of robustness or forecast reliability.

Initialization remains relevant

Research needs a standard chart, consecutive valid changes and positive weighted movement, with 147 settling changes by default. That is not proof of infinite-history convergence. Older contribution includes initialization residuals. The script uses available history without a fixed 6000-bar execution cap.

Match held and live readings

By default only the open bar holds the previous close. Compare confirmed bars or matching live settings with another native RSI. Turning hold off changes the intrabar display, not the close-only commitment of episodes, entry labels, outcomes and alerts.

Dates filter, not initialize

Date filters use close times without loading missing history or resetting RSI. Dataset start, source, settings and feed corrections can alter initialization and statistics. External sources can repaint upstream; no absolute non-repainting claim is justified.

Non-overlap is not independence

Defaults accept the earliest classifiable entry across both sides and skip through its+K bar inclusive without using outcomes. Entry overshoot, history, symbol, timeframe and parameters may explain group differences. Post-result tuning adds selection bias; completed-only comparisons do not estimate survival, remaining duration or profits.

Important

Removal bounds are not volatility or confidence bands; order bounds are not future paths. EQ is not independent sample size and persistence is not a win rate. The indicator places no orders and does not simulate strategy profit.

07 — FAQ

Frequently asked questions

Clarify candidate sets, timing and sample interpretation.

Does H change RSI length?

No. N sets RSI length; H partitions the existing smoothed state into recent and older components.

Is the violet base a separate RSI?

No. It is 50 plus the older contribution to the current RSI, not an independently calculated oscillator.

Is gold shading a forecast range?

No. It is arithmetic sensitivity to deleting one weighted term, not a price-volatility or confidence band.

Are full removal and entry groups identical?

No. Full removal includes age 0. Entry research fixes that triggering change and tests only ages 1…H−1.

Why can the open-bar value differ from native RSI?

The default holds the previous closed reading. Compare closed bars or matching live-display settings.

Is it free?

The source is published under Mozilla Public License 2.0, with implemented features available without an author-side access fee or external service. Check license terms before reuse.

Source basis and update policy

This guide is grounded in SG Group’s live catalogue, the script’s published TradingView description, and the user-facing inputs in its open source. Labels and defaults can change after a script update.