MathSpecialFunctionsGammaLibrary "MathSpecialFunctionsGamma"
Gamma Functions.
GammaQ(index) Enumeration of the polynomial coefficients for the "GammaLn" approximation.
Parameters:
index : int, 0 => index => 10, index of coeficient.
Returns: float
GammaLn(z) Computes the logarithm of the Gamma function.
Parameters:
z : The argument of the gamma function.
Returns: The logarithm of the gamma function.
Gamma(z) Computes the Gamma function.
Parameters:
z : The argument of the gamma function.
Returns: float, The logarithm of the gamma function.
GammaLowerRegularized(a, x)
Parameters:
a : float, The argument for the gamma function.
x : float, The upper integral limit.
Returns: float, The lower incomplete gamma function.
GammaUpperRegularized(a, x) Returns the upper incomplete regularized gamma function
Parameters:
a : float, The argument for the gamma function.
x : float, The lower integral limit.
Returns: float, The upper incomplete regularized gamma function.
GammaUpperIncomplete(a, x) Returns the upper incomplete gamma function.
Parameters:
a : float, The argument for the gamma function.
x : float, The lower integral limit.
Returns: float, The upper incomplete gamma function.
GammaLowerIncomplete(a, x)
Parameters:
a : float, The argument for the gamma function.
x : float, The upper integral limit.
Returns: float, The lower incomplete gamma function.
Göstergeler ve stratejiler
ProbabilityLibrary "Probability"
erf(value) Complementary error function
Parameters:
value : float, value to test.
Returns: float
ierf_mcgiles(value) Computes the inverse error function using the Mc Giles method, sacrifices accuracy for speed.
Parameters:
value : float, -1.0 >= _value >= 1.0 range, value to test.
Returns: float
ierf_double(value) computes the inverse error function using the Newton method with double refinement.
Parameters:
value : float, -1. > _value > 1. range, _value to test.
Returns: float
ierf(value) computes the inverse error function using the Newton method.
Parameters:
value : float, -1. > _value > 1. range, _value to test.
Returns: float
complement(probability) probability that the event will not occur.
Parameters:
probability : float, 0 >=_p >= 1, probability of event.
Returns: float
entropy_gini_impurity_single(probability) Gini Inbalance or Gini index for a given probability.
Parameters:
probability : float, 0>=x>=1, probability of event.
Returns: float
entropy_gini_impurity(events) Gini Inbalance or Gini index for a series of events.
Parameters:
events : float , 0>=x>=1, array with event probability's.
Returns: float
entropy_shannon_single(probability) Entropy information value of the probability of a single event.
Parameters:
probability : float, 0>=x>=1, probability value.
Returns: float, value as bits of information.
entropy_shannon(events) Entropy information value of a distribution of events.
Parameters:
events : float , 0>=x>=1, array with probability's.
Returns: float
inequality_chebyshev(n_stdeviations) Calculates Chebyshev Inequality.
Parameters:
n_stdeviations : float, positive over or equal to 1.0
Returns: float
inequality_chebyshev_distribution(mean, std) Calculates Chebyshev Inequality.
Parameters:
mean : float, mean of a distribution
std : float, standard deviation of a distribution
Returns: float
inequality_chebyshev_sample(data_sample) Calculates Chebyshev Inequality for a array of values.
Parameters:
data_sample : float , array of numbers.
Returns: float
intersection_of_independent_events(events) Probability that all arguments will happen when neither outcome
is affected by the other (accepts 1 or more arguments)
Parameters:
events : float , 0 >= _p >= 1, list of event probabilities.
Returns: float
union_of_independent_events(events) Probability that either one of the arguments will happen when neither outcome
is affected by the other (accepts 1 or more arguments)
Parameters:
events : float , 0 >= _p >= 1, list of event probabilities.
Returns: float
mass_function(sample, n_bins) Probabilities for each bin in the range of sample.
Parameters:
sample : float , samples to pool probabilities.
n_bins : int, number of bins to split the range
@return float
cumulative_distribution_function(mean, stdev, value) Use the CDF to determine the probability that a random observation
that is taken from the population will be less than or equal to a certain value.
Or returns the area of probability for a known value in a normal distribution.
Parameters:
mean : float, samples to pool probabilities.
stdev : float, number of bins to split the range
value : float, limit at which to stop.
Returns: float
transition_matrix(distribution) Transition matrix for the suplied distribution.
Parameters:
distribution : float , array with probability distribution. ex:.
Returns: float
diffusion_matrix(transition_matrix, dimension, target_step) Probability of reaching target_state at target_step after starting from start_state
Parameters:
transition_matrix : float , "pseudo2d" probability transition matrix.
dimension : int, size of the matrix dimension.
target_step : number of steps to find probability.
Returns: float
state_at_time(transition_matrix, dimension, start_state, target_state, target_step) Probability of reaching target_state at target_step after starting from start_state
Parameters:
transition_matrix : float , "pseudo2d" probability transition matrix.
dimension : int, size of the matrix dimension.
start_state : state at which to start.
target_state : state to find probability.
target_step : number of steps to find probability.
MathStatisticsKernelDensityEstimationLibrary "MathStatisticsKernelDensityEstimation"
(KDE) Method for Kernel Density Estimation
kde(observations, kernel, bandwidth, nsteps)
Parameters:
observations : float array, sample data.
kernel : string, the kernel to use, default='gaussian', options='uniform', 'triangle', 'epanechnikov', 'quartic', 'triweight', 'gaussian', 'cosine', 'logistic', 'sigmoid'.
bandwidth : float, bandwidth to use in kernel, default=0.5, range=(0, +inf), less will smooth the data.
nsteps : int, number of steps in range of distribution, default=20, this value is connected to how many line objects you can display per script.
Returns: tuple with signature: (float array, float array)
draw_horizontal(distribution_x, distribution_y, distribution_lines, graph_lines, graph_labels) Draw a horizontal distribution at current location on chart.
Parameters:
distribution_x : float array, distribution points x value.
distribution_y : float array, distribution points y value.
distribution_lines : line array, array to append the distribution curve lines.
graph_lines : line array, array to append the graph lines.
graph_labels : label array, array to append the graph labels.
Returns: void, updates arrays: distribution_lines, graph_lines, graph_labels.
draw_vertical(distribution_x, distribution_y, distribution_lines, graph_lines, graph_labels) Draw a vertical distribution at current location on chart.
Parameters:
distribution_x : float array, distribution points x value.
distribution_y : float array, distribution points y value.
distribution_lines : line array, array to append the distribution curve lines.
graph_lines : line array, array to append the graph lines.
graph_labels : label array, array to append the graph labels.
Returns: void, updates arrays: distribution_lines, graph_lines, graph_labels.
style_distribution(lines, horizontal, to_histogram, line_color, line_style, linewidth) Style the distribution lines.
Parameters:
lines : line array, distribution lines to style.
horizontal : bool, default=true, if the display is horizontal(true) or vertical(false).
to_histogram : bool, default=false, if graph style should be switched to histogram.
line_color : color, default=na, if defined will change the color of the lines.
line_style : string, defaul=na, if defined will change the line style, options=('na', line.style_solid, line.style_dotted, line.style_dashed, line.style_arrow_right, line.style_arrow_left, line.style_arrow_both)
linewidth : int, default=na, if defined will change the line width.
Returns: void.
style_graph(lines, lines, horizontal, line_color, line_style, linewidth) Style the graph lines and labels
Parameters:
lines : line array, graph lines to style.
lines : labels array, graph labels to style.
horizontal : bool, default=true, if the display is horizontal(true) or vertical(false).
line_color : color, default=na, if defined will change the color of the lines.
line_style : string, defaul=na, if defined will change the line style, options=('na', line.style_solid, line.style_dotted, line.style_dashed, line.style_arrow_right, line.style_arrow_left, line.style_arrow_both)
linewidth : int, default=na, if defined will change the line width.
Returns: void.
MathStatisticsKernelFunctionsLibrary "MathStatisticsKernelFunctions"
TODO: add library description here
uniform(distance, bandwidth) Uniform kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
triangular(distance, bandwidth) Triangular kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
epanechnikov(distance, bandwidth) Epanechnikov kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
quartic(distance, bandwidth) Quartic kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
triweight(distance, bandwidth) Triweight kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
tricubic(distance, bandwidth) Tricubic kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
gaussian(distance, bandwidth) Gaussian kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
cosine(distance, bandwidth) Cosine kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
logistic(distance, bandwidth) logistic kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
sigmoid(distance, bandwidth) Sigmoid kernel.
Parameters:
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
select(kernel, distance, bandwidth) Kernel selection method.
Parameters:
kernel : string, kernel to select. (options="uniform", "triangle", "epanechnikov", "quartic", "triweight", "tricubic", "gaussian", "cosine", "logistic", "sigmoid")
distance : float, distance to kernel origin.
bandwidth : float, default=1.0, bandwidth limiter to weight the kernel.
Returns: float.
MathTransformsHartleyLibrary "MathTransformsHartley"
implementation of the Fast Discrete Hartley Transform(DHT).
naive(samples) Generic naive transform for the (DHT).
Parameters:
samples : float array, 1d data.
Returns: float array.
fdht(samples) Fast Discrete Hartley Transform (DHT).
Parameters:
samples : float array, data samples.
Returns: float array.
idht(samples, asymmetric_scaling) Inverse Discrete Hartley Transform (DHT).
Parameters:
samples : float array, data samples.
asymmetric_scaling : bool, default=true, scaling option.
Returns: float array.
MathSpecialFunctionsTestFunctionsLibrary "MathSpecialFunctionsTestFunctions"
Methods for test functions.
rosenbrock(input_x, input_y) Valley-shaped Rosenbrock function for 2 dimensions: (x,y) -> (1-x)^2 + 100*(y-x^2)^2.
Parameters:
input_x : float, common range within (-5.0, 10.0) or (-2.048, 2.048).
input_y : float, common range within (-5.0, 10.0) or (-2.048, 2.048).
Returns: float
rosenbrock_mdim(samples) Valley-shaped Rosenbrock function for 2 or more dimensions.
Parameters:
samples : float array, common range within (-5.0, 10.0) or (-2.048, 2.048).
Returns: float
himmelblau(input_x, input_y) Himmelblau, a multi-modal function: (x,y) -> (x^2+y-11)^2 + (x+y^2-7)^2
Parameters:
input_x : float, common range within (-6.0, 6.0 ).
input_y : float, common range within (-6.0, 6.0 ).
Returns: float
rastrigin(samples) Rastrigin, a highly multi-modal function with many local minima.
Parameters:
samples : float array, common range within (-5.12, 5.12 ).
Returns: float
drop_wave(input_x, input_y) Drop-Wave, a multi-modal and highly complex function with many local minima.
Parameters:
input_x : float, common range within (-5.12, 5.12 ).
input_y : float, common range within (-5.12, 5.12 ).
Returns: float
ackley(input_x) Ackley, a function with many local minima. It is nearly flat in outer regions but has a large hole at the center.
Parameters:
input_x : float array, common range within (-32.768, 32.768 ).
Returns: float
bohachevsky1(input_x, input_y) Bowl-shaped first Bohachevsky function.
Parameters:
input_x : float, common range within (-100.0, 100.0 ).
input_y : float, common range within (-100.0, 100.0 ).
Returns: float
matyas(input_x, input_y) Plate-shaped Matyas function.
Parameters:
input_x : float, common range within (-10.0, 10.0 ).
input_y : float, common range within (-10.0, 10.0 ).
Returns: float
six_hump_camel(input_x, input_y) Valley-shaped six-hump camel back function.
Parameters:
input_x : float, common range within (-3.0, 3.0 ).
input_y : float, common range within (-2.0, 2.0 ).
Returns: float
MathGeometryCurvesChaikinLibrary "MathGeometryCurvesChaikin"
Implements the chaikin algorithm to create a curved path, from assigned points.
chaikin(points_x, points_y, closed) Chaikin algorithm method, uses provided points to generate a smoothed path.
Parameters:
points_x : float array, the x value of points.
points_y : float array, the y value of points.
closed : bool, default=false, is the path closed or not.
Returns: tuple with 2 float arrays.
smooth(points_x, points_y, iterations, closed) Iterate the chaikin algorithm, to smooth a sample of points into a curve path.
Parameters:
points_x : float array, the x value of points.
points_y : float array, the y value of points.
iterations : int, number of iterations to apply the smoothing.
closed : bool, default=false, is the path closed or not.
Returns: array of lines.
draw(path_x, path_y, closed) Draw the path.
Parameters:
path_x : float array, the x value of the path.
path_y : float array, the y value of the path.
closed : bool, default=false, is the path closed or not.
Returns: array of lines.
Double_Triple_EMALibrary "Double_Triple_EMA"
Provides the functions to calculate Double and Triple Exponentional Moving Averages (DEMA & TEMA).
dema(_source, _length) Calculates Double Exponentional Moving Averages (DEMA)
Parameters:
_source : -> Open, Close, High, Low, etc ('close' is used if no argument is supplied)
_length : -> DEMA length
Returns: Double Exponential Moving Average (DEMA) of an input source at the specified input length
tema(_source, _length) Calculates Triple Exponentional Moving Averages (TEMA)
Parameters:
_source : -> Open, Close, High, Low, etc ('close' is used if no argument is supplied)
_length : -> TEMA length
Returns: Triple Exponential Moving Average (TEMA) of an input source at the specified input length
AutoColorLibrary "AutoColor"
Function provides rgb color based on deviation of highest and lowest value for the period from current value
fColor(src1, len1) Calculates rgb color based on deviation of highest and lowest value for the period from current value
Parameters:
src1 : Series to use (`close` is used if no argument is supplied).
len1 : Length for highest and lowest series (`10` is used if no argument is supplied).
Returns: color for series
Library_All_In_OneLibrary "Library_All_In_One"
fnRSI()
fnTSI()
Discription:
Contains several functions of Pinescript all in one Library. This reduce your coding.
How to use:
import Wilson-IV/Library_All_In_One/1 as _lib
Examples of plotting the RSI and TSI:
plot(_lib.fnRSI(close, 14))
plot(_lib.fnTSI(close, 25, 14))
Markets:
It can be used to all markets.
NOTE:
It will expands with more function during time.
multiMaLibrary "multiMa"
Provides function that returns the type of moving average requested.
ma(type, src, len) Returns the moving average requested.
Parameters:
type : The type of moving average (choose one of "EMA", "SMA", "DEMA", "TEMA", "WMA", "VWMA", "SMMA", "HMA")
src : The source
len : The length
Returns: The moving average requested or `na`
MathSpecialFunctionsLogisticLibrary "MathSpecialFunctionsLogistic"
Methods for logistic equation.
logistic(probability) Computes the logistic function.
Parameters:
probability : float, value to compute the logistic function.
Returns: float
logit(probability) Computes the logit function, the inverse of the sigmoid logistic function.
Parameters:
probability : float, value to compute the logit function.
Returns: float
MathTrigonometryLibrary "MathTrigonometry"
Trigonometric methods.
sinc(value) Normalized sinc function.
Parameters:
value : float, value.
Returns: float.
cot(value) Cotangent of value.
Parameters:
value : float, value.
Returns: float.
csc(value) Cosecant of value.
Parameters:
value : float, value.
Returns: float.
sec(value) Secant of value.
Parameters:
value : float, value.
Returns: float.
acot(value) Arc cotangent of value.
Parameters:
value : float, adjacent value.
Returns: float.
asec(value) Arc secant of value.
Parameters:
value : float, hypotenuse value.
Returns: float.
acsc(value) Arc cosecant of value.
Parameters:
value : float, hipotenuse value.
Returns: float.
sinh(angle) Hyperbolic sine of angle.
Parameters:
angle : float, value.
Returns: float.
cosh(angle) Hyperbolic cosine of angle.
Parameters:
angle : float, value.
Returns: float.
tanh(angle) Hyperbolic tangent of angle.
Parameters:
angle : float, value.
Returns: float.
coth(angle) Hyperbolic cotangent of angle.
Parameters:
angle : float, value.
Returns: float.
sech(angle) Hyperbolic secant of angle.
Parameters:
angle : float, value.
Returns: float.
csch(angle) Hyperbolic cosecant of angle.
Parameters:
angle : float, value.
Returns: float.
asinh(value) Hyperbolic area sine.
Parameters:
value : float, value.
Returns: float.
acosh(value) Hyperbolic area cosine.
Parameters:
value : float, value.
Returns: float.
atanh(value) Hyperbolic area tangent.
Parameters:
value : float, value.
Returns: float.
acoth(value) Hyperbolic area cotangent.
Parameters:
value : float, value.
Returns: float.
asech(value) Hyperbolic area secant.
Parameters:
value : float, value.
Returns: float.
acsch(value) Hyperbolic area cosecant.
Parameters:
value : float, value.
Returns: float.
MathSearchDijkstraLibrary "MathSearchDijkstra"
Shortest Path Tree Search Methods using Dijkstra Algorithm.
min_distance(distances, flagged_vertices) Find the lowest cost/distance.
Parameters:
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 index.
dijkstra(matrix_graph, dim_x, dim_y, start) Dijkstra Algorithm, perform a greedy tree search to calculate the cost/distance to selected start node at each vertex.
Parameters:
matrix_graph : int array, matrix holding the graph adjacency list and costs/distances.
dim_x : int, x dimension of matrix_graph.
dim_y : int, y dimension of matrix_graph.
start : int, the vertex index to start search.
Returns: int array, set with costs/distances to each vertex from start vertexs.
shortest_path(start, end, matrix_graph, dim_x, dim_y) Retrieves the shortest path between 2 vertices in a graph using Dijkstra Algorithm.
Parameters:
start : int, the vertex index to start search.
end : int, the vertex index to end search.
matrix_graph : int array, matrix holding the graph adjacency list and costs/distances.
dim_x : int, x dimension of matrix_graph.
dim_y : int, y dimension of matrix_graph.
Returns: int array, set with vertex indices to the shortest path.
MathGaussFunctionLibrary "MathGaussFunction"
Implements multiple gauss methods.
f_1d(point_x, sigma) 1-D Gaussian function.
Parameters:
point_x : float, x value.
sigma : float, sigma value, default=1.0.
Returns: float, function's value at point_x.
f_2d(point_x, point_y, sigma) 2-D Gaussian function.
Parameters:
point_x : float, x value.
point_y : float, y value.
sigma : float, sigma value, default=1.0.
Returns: float, function's value at (point_x, point_y).
kernel_1d(size, sigma) 1-D Gaussian kernel.
Parameters:
size : int, Kernel size (should be odd), .
sigma : float, sigma value, default=1.0.
Returns: float array, Returns 1-D Gaussian kernel of the specified size.
kernel_2d(size, sigma) 2-D Gaussian kernel.
Parameters:
size : int, Kernel size (should be odd), .
sigma : float, sigma value, default=1.0.
Returns: float array, Returns 2-D Gaussian kernel of the specified size.
MathFinancialAbsoluteRiskMeasuresLibrary "MathFinancialAbsoluteRiskMeasures"
Financial Absolute Risk Measures.
gain_stdev(sample) Standard deviation of gains in a data sample.
Parameters:
sample : float array, data sample.
Returns: float.
loss_stdev(sample) Standard deviation of losses in a data sample.
Parameters:
sample : float array, data sample.
Returns: float.
downside_stdev(sample, minimal_acceptable_return) Downside standard deviation in a data sample.
Parameters:
sample : float array, data sample.
minimal_acceptable_return : float, minimum gain value.
Returns: float.
semi_stdev(sample) Standard deviation of less than average returns in a data sample.
Parameters:
sample : float array, data sample.
Returns: float.
gain_loss_ratio(sample) ratio of average gains of average losses in a data sample.
Parameters:
sample : float array, data sample.
Returns: float.
compound_risk_score(source, length) Compound Risk Score
Parameters:
source : float, input data, default=close.
length : int, period of observation, default=12)
Returns: float.