A simple banchmark library to analyse script performance and bottlenecks.
Very useful if you are developing an overly complex application in Pine Script, or trying to optimise a library / function / algorithm...
Supports artificial looping benchmarks (of fast functions)
Supports integrated linear benchmarks (of expensive scripts)
Functions for determining if volatility (true range) is within or exceeds normal.
The "True Range" (ta.tr) is used for measuring volatility.
Values are normalized by the volume adjusted weighted moving average (VAWMA) to be more like percent moves than price.
current(len) Returns the current price adjusted volatitlity...
Functions for acquiring outlier levels and acquiring a cleaned version of a series.
outlierLevel(src, len, level) Gets the (standard deviation) outlier level for a given series.
src : The series to average and add a multiple of the standard deviation to.
len : The The number of bars to measure.
level : The...
Helps in determining the relative deviation from the open of the day compared to the high or low values.
hlcDeltaArrays(daysPrior, maxDeviation, spec, res) Retuns a set of arrays representing the daily deviation of price for a given number of days.
daysPrior : Number of days back to get the close from.
Based on Moments (Mean,Variance,Skewness,Kurtosis) . Rewritten for Pinescript v5.
logReturns(src) Calculates log returns of a series (e.g log percentage change)
src : Source to use for the returns calculation (e.g. close).
Returns: Log percentage returns of a series
mean(src, length) Calculates the mean of a...
A simple cache library to store key value pairs.
Fed up of injecting and returning so many values all the time?
Want to separate your code and keep it clean?
Need to make an expensive calculation and use the results in numerous places?
Want to throttle calculations or persist random values across bars or ticks?
Then you've come to...
Library to calculate Hurst Exponent refactored from Hurst Exponent - Detrended Fluctuation Analysis
demean(src) Calculates a series subtracted from the series mean.
src : The series used to calculate the difference from the mean (e.g. log returns).
Returns: The series subtracted from the series mean
Provides functions for calculating Nick Rypock Trailing Reverse (NRTR) trend values with higher precision offsets for both low, and high points rather than the standard single offset.
pnrtr(float low_offset = 0.2, float high_offset = 0.2, float value = close)
Offset used for nrtr low_point calculations. Default is 0.2.
Library "FFTLibrary" contains a function for performing Fast Fourier Transform (FFT) along with a few helper functions. In general, FFT is defined for complex inputs and outputs. The real and imaginary parts of formally complex data are treated as separate arrays (denoted as x and y). For real-valued data, the array of imaginary parts should be filled with...
Methods for probability distribution sampling selection.
sample(probabilities) Computes a random selected index from a probability distribution.
probabilities : float array, probabilities of sample.
Methods to count number of elements in arrays
count_float(sample, value) Counts the number of elements equal to provided value in array.
sample : float array, sample data to process.
value : float value to check for equality.
count_int(sample, value) Counts the number of elements...
Library "LinearRegressionLibrary" contains functions for fitting a regression line to the time series by means of different models, as well as functions for estimating the accuracy of the fit.
Linear regression algorithms:
RepeatedMedian(y, n, lastBar) applies repeated median regression (robust linear regression algorithm) to the input time series...
This is a public library that include the functions explained below. The libraries are considered public domain code and permission is not required from the author if you reuse these functions in your open-source scripts
Method to generate decision tree based on weights.
decision_tree(weights, depth) Method to generate decision tree based on weights.
weights : float array, weights for decision consideration.
depth : int, depth of the tree.
Returns: int array
Method for linear Forecast, same as found in excel and other sheet packages.
forecast(sample_x, sample_y, target_x) linear forecast method.
sample_x : float array, sample data X value.
sample_y : float array, sample data Y value.
target_x : float, target X to get Y forecast value.
Shows the Daily, Weekly, Monthly, Quarterly, and Yearly VWAP.
Also shows the previous closing VWAP, which is usually very near the HLC3 standard pivot for the previous time frame. i.e. The previous daily VWAP closing price is usually near the current Daily Pivot. Tickers interact well with the previous Daily and Weekly closing VWAP.
Enabling the STDEV bands...
This library holds technical analysis functions calculating values for which no Pine built-in exists.
cagr(entryTime, entryPrice, exitTime, exitPrice)
It calculates the "Compound Annual Growth Rate" between two points in time. The CAGR is a notional, annualized growth rate that assumes all profits are reinvested....