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....
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
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...
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.
// 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 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.
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.
TODO: add library description here
array_moving_average(sample, length, ommit_initial, fillna) Moving Average values for selected data.
sample : float array, sample data values.
length : int, length to smooth the data.
ommit_initial : bool, default=true, ommit values at the start of the data under the...
This is not a foolproof method for finding every prime number but will work well on assets $10 to $100. I will be working on something more robust with scaling for all assets. If you want a main pane indicator with just the background coloring keep the indicator as it is. If you want a lower pane indicator get rid of the current study function and replace with the...
This script calculates and displays some bar statistics.
For the bar length statistics, it takes every length of upper or lower movements and calculates their average (with SD), median, and max. That way, you can see whether there is a bias in the market or not.
Eg.: If for 10 bars, the market moved 2 up, then 1 down, then 3 up, then 2 down, and 2 up, the...