1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new library, select all of the template text and paste. Press Save and give it a name.
4Publish or import itA library draws nothing. Publish it from the editor, then import its functions in your own scripts.
Source Code
185 lines of Pine Script v6 from edu_lib/relative_value.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
RelativeValue collects values within a period that restarts on an anchor timeframe, then averages the values from past periods at the same time offset. Settings cover the anchor timeframe, the number of past periods averaged, cumulative or regular calculation mode, and whether unconfirmed bars are estimated. It draws nothing on its own and is imported by other scripts.
Relative value against past periods at the same time offset
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Anchor Timeframe
timeframe
D
resetTimeInput
No. of periods to avg.
int
5
lengthInput
Calculation Mode
string
Cumulative
modeInput
Show as Relative Ratio
string
EQ02
showRvolInput
Estimate Unconfirmed
string
EQ02
estimateInput
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This Pine Script v5 library walks historical price, volume, time and amount series until a requested number of hours is covered, stopping at 4999 bars. TimeAligned returns the bar count, net and absolute price changes, net and absolute log-price changes, volum
This library exports utilities for calculating moving averages rather than drawing them on a chart. It provides a volume-adjusted weighted moving average that combines volume weighting with triangular recent-bar emphasis, and a coefficient moving average that
The library detects price gap inefficiencies using structural flow analytics. It identifies new bullish and bearish gaps with their top and bottom levels, tracks mitigation status, and checks flow alignment between price and CVD trends. It applies regime detec
SMC Profile Engine is a Pine Script library designed to build custom volume profiles on TradingView. It provides structured data types including Bucket, ProfileConfig, and Profile to manage volume calculations across price levels. The library facilitates track
AIActivationFunctionsBipolarSigmoid is a Pine Script library that provides mathematical implementations of the bipolar sigmoid activation function and its derivatives for machine learning algorithms. It calculates bipolar sigmoid values bounded between -1 and
KernelFunctions is a Pine Script v5 library that exports kernel weight functions for Nadaraya-Watson style estimation. It calculates a Rational Quadratic kernel, a Gaussian kernel based on a radial basis function, and a periodic kernel that models repeating be