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....
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...
K-Means Clustering Method.
nearest(point_x, point_y, centers_x, centers_y) finds the nearest center to a point and returns its distance and center index.
point_x : float, x coordinate of point.
point_y : float, y coordinate of point.
centers_x : float array, x coordinates of cluster centers.
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 compound interest.
simple_compound(principal, rate, duration) Computes compound interest for given duration.
principal : float, the principal or starting value.
rate : float, the rate of interest.
duration : float, the period of growth.
Shortest Path Tree Search Methods using Dijkstra Algorithm.
min_distance(distances, flagged_vertices) Find the lowest cost/distance.
distances : float array, data set with distance costs to start index.
flagged_vertices : bool array, data set with visited vertices flags.
Returns: int, lowest cost/distance...
// continuation of prime number checker with strat commands and normal distribution theory put in
//pump/dump trend following strategy idea added.
//Pseudo Random Number Generator Box Muller Normal Distribution Method - code from Function - Functions to generate Random values by RicardoSantos. Dots are calculated by an adaptation of the ideas
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
Financial Absolute Risk Measures.
gain_stdev(sample) Standard deviation of gains in a data sample.
sample : float array, data sample.
loss_stdev(sample) Standard deviation of losses in a data sample.
sample : float array, data sample.
This is a library to add matrix / 2D array functionality to Pinescript.
once you import the library at the beginning of your script, you can add all the functions described below just by calling them like you do any other built'in function.
PS. if you find functionality or calculation errors in the functions,...
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.
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...
erf(value) Complementary error function
value : float, value to test.
ierf_mcgiles(value) Computes the inverse error function using the Mc Giles method, sacrifices accuracy for speed.
value : float, -1.0 >= _value >= 1.0 range, value to test.