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.
MathOperatorLibrary "MathOperator"
Methods to handle operators.
add(value_a, value_b) Add value a to b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: float.
subtract(value_a, value_b) subtract value b from a.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: float.
multiply(value_a, value_b) multiply value a with b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: float.
divide(value_a, value_b) divide value a with b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: float.
remainder(value_a, value_b) remainder of a with b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: float.
equal(value_a, value_b) equality of value a with b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: bool.
not_equal(value_a, value_b) inequality of value a with b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: bool.
over(value_a, value_b) value a is over b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: bool.
under(value_a, value_b) value a is under b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: bool.
over_equal(value_a, value_b) value a is over equal b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: bool.
under_equal(value_a, value_b) value a is under equal b.
Parameters:
value_a : float, value a.
value_b : float, value b.
Returns: bool.
and_(value_a, value_b) logical and of a with b
Parameters:
value_a : bool, value a.
value_b : bool, value b.
Returns: bool.
or_(value_a, value_b) logical or of a with b.
Parameters:
value_a : bool, value a.
value_b : bool, value b.
Returns: bool.
MathExtensionLibrary "MathExtension"
Math Extension.
log2(_value) calculate log base 2
Parameters:
_value : float, number.
Returns: float, base 2 logarithm of value.
fmod(numerator, denominator) float remainder of x divided by y.
Parameters:
numerator : float, division numerator.
denominator : float, division denuminator.
Returns: float
fractional(value) computes the fractional part of the argument value.
Parameters:
value : float, value to compute.
Returns: float, fractional part.
integral(value) Find the integral of value.
Parameters:
value : float, value.
Returns: float.
atan2(value_x, value_y) Approximation to atan2 calculation, arc tangent of y/ x in the range (-pi,pi) radians.
Parameters:
value_x : float, value x.
value_y : float, value y.
Returns: float, value with angle in radians. (negative if quadrante 3 or 4)
hypotenuse(value_x, value_y) Multidimensional euclidean distance from the origin to a point.
Parameters:
value_x : float, value x.
value_y : float, value y.
Returns: float
near_equal(value_a, value_b, relative_tolerance, absolute_tolerance) Determine whether two floating point numbers are near in value.
Parameters:
value_a : float, value to compare with.
value_b : float, value to be compared against.
relative_tolerance : float, default (1.0e-09).
absolute_tolerance : float, default (0.0).
Returns: bool
factorize(value) Factorize a number.
Parameters:
value : int, positive number.
Returns: int
permutations(options_size, combo_size) Number of ways to choose k items from n items without repetition and with order.
Parameters:
options_size : int, number of items to pool from
combo_size : int, number of items to be chosen
Returns: int
combinations(options_size, combo_size) Find the total number of possibilities to choose k things from n items
Parameters:
options_size : int, number of items to pool from
combo_size : int, number of items to be chosen
Returns: int
MathConstantsUniversalLibrary "MathConstantsUniversal"
Mathematical Constants
SpeedOfLight() Speed of Light in Vacuum: c_0 = 2.99792458e8 (defined, exact; 2007 CODATA)
MagneticPermeability() Magnetic Permeability in Vacuum: mu_0 = 4*Pi * 10^-7 (defined, exact; 2007 CODATA)
ElectricPermittivity() Electric Permittivity in Vacuum: epsilon_0 = 1/(mu_0*c_0^2) (defined, exact; 2007 CODATA)
CharacteristicImpedanceVacuum() Characteristic Impedance of Vacuum: Z_0 = mu_0*c_0 (defined, exact; 2007 CODATA)
GravitationalConstant() Newtonian Constant of Gravitation: G = 6.67429e-11 (2007 CODATA)
PlancksConstant() Planck's constant: h = 6.62606896e-34 (2007 CODATA)
DiracsConstant() Reduced Planck's constant: h_bar = h / (2*Pi) (2007 CODATA)
PlancksMass() Planck mass: m_p = (h_bar*c_0/G)^(1/2) (2007 CODATA)
PlancksTemperature() Planck temperature: T_p = (h_bar*c_0^5/G)^(1/2)/k (2007 CODATA)
PlancksLength() Planck length: l_p = h_bar/(m_p*c_0) (2007 CODATA)
PlancksTime() Planck time: t_p = l_p/c_0 (2007 CODATA)
MathConstantsScientificLibrary "MathConstantsScientific"
Mathematical Constants
Yotta() The SI prefix factor corresponding to 1 000 000 000 000 000 000 000 000
Zetta() The SI prefix factor corresponding to 1 000 000 000 000 000 000 000
Exa() The SI prefix factor corresponding to 1 000 000 000 000 000 000
Peta() The SI prefix factor corresponding to 1 000 000 000 000 000
Tera() The SI prefix factor corresponding to 1 000 000 000 000
Giga() The SI prefix factor corresponding to 1 000 000 000
Mega() The SI prefix factor corresponding to 1 000 000
Kilo() The SI prefix factor corresponding to 1 000
Hecto() The SI prefix factor corresponding to 100
Deca() The SI prefix factor corresponding to 10
Deci() The SI prefix factor corresponding to 0.1
Centi() The SI prefix factor corresponding to 0.01
Milli() The SI prefix factor corresponding to 0.001
Micro() The SI prefix factor corresponding to 0.000 001
Nano() The SI prefix factor corresponding to 0.000 000 001
Pico() The SI prefix factor corresponding to 0.000 000 000 001
Femto() The SI prefix factor corresponding to 0.000 000 000 000 001
Atto() The SI prefix factor corresponding to 0.000 000 000 000 000 001
Zepto() The SI prefix factor corresponding to 0.000 000 000 000 000 000 001
Yocto() The SI prefix factor corresponding to 0.000 000 000 000 000 000 000 001