Library "FunctionMinkowskiDistance" Method for Minkowski Distance, The Minkowski distance or Minkowski metric is a metric in a normed vector space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance. It is named after the German mathematician Hermann Minkowski. reference: en.wikipedia.org double(point_ax,...
Library "regress" produces the slope (beta), y-intercept (alpha) and coefficient of determination for a linear regression regress(x, y, len) regress: computes alpha, beta, and r^2 for a linear regression of y on x Parameters: x : the explaining (independent) variable y : the dependent variable len : use the most recent "len" values of x and...
Library "FunctionNNLayer" Generalized Neural Network Layer method. function(inputs, weights, n_nodes, activation_function, bias, alpha, scale) Generalized Layer. Parameters: inputs : float array, input values. weights : float array, weight values. n_nodes : int, number of nodes in layer. activation_function : string, default='sigmoid',...
Library "FunctionNNPerceptron" Perceptron Function for Neural networks. function(inputs, weights, bias, activation_function, alpha, scale) generalized perceptron node for Neural Networks. Parameters: inputs : float array, the inputs of the perceptron. weights : float array, the weights for inputs. bias : float, default=1.0, the default bias...
Library "MLActivationFunctions" Activation functions for Neural networks. binary_step(value) Basic threshold output classifier to activate/deactivate neuron. Parameters: value : float, value to process. Returns: float linear(value) Input is the same as output. Parameters: value : float, value to process. Returns: float sigmoid(value) ...
Library "MLLossFunctions" Methods for Loss functions. mse(expects, predicts) Mean Squared Error (MSE) " MSE = 1/N * sum ((y - y')^2) ". Parameters: expects : float array, expected values. predicts : float array, prediction values. Returns: float binary_cross_entropy(expects, predicts) Binary Cross-Entropy Loss (log). Parameters: ...
Library "Divergence" Calculates a divergence between 2 series bullish(_src, _low, depth) Calculates bullish divergence Parameters: _src : Main series _low : Comparison series (`low` is used if no argument is supplied) depth : Fractal Depth (`2` is used if no argument is supplied) Returns: 2 boolean values for regular and hidden...
Library "FunctionPeakDetection" Method used for peak detection, similar to MATLAB peakdet method function(sample_x, sample_y, delta) Method for detecting peaks. Parameters: sample_x : float array, sample with indices. sample_y : float array, sample with data. delta : float, positive threshold value for detecting a peak. Returns: tuple with...
Library "DailyDeviation" 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. Parameters: daysPrior : Number of days back to get the close from. ...
Library "Volatility" 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...
Library "DataCleaner" 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. Parameters: src : The series to average and add a multiple of the standard deviation to. len : The The number of bars to measure. level : The...
Library "bench" 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) One...
Library "HurstExponent" Library to calculate Hurst Exponent refactored from Hurst Exponent - Detrended Fluctuation Analysis demean(src) Calculates a series subtracted from the series mean. Parameters: src : The series used to calculate the difference from the mean (e.g. log returns). Returns: The series subtracted from the series mean ...
Library "Moments" Based on Moments (Mean,Variance,Skewness,Kurtosis) . Rewritten for Pinescript v5. logReturns(src) Calculates log returns of a series (e.g log percentage change) Parameters: 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...
Library "pNRTR" 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) low_offset Offset used for nrtr low_point calculations. Default is 0.2. ...
Library "cache" 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 "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...
Library "FunctionProbabilityDistributionSampling" Methods for probability distribution sampling selection. sample(probabilities) Computes a random selected index from a probability distribution. Parameters: probabilities : float array, probabilities of sample. Returns: int.