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.
MATH
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.
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.
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
MathConstantsElectromagneticLibrary "MathConstantsElectromagnetic"
Mathematical Constants
ElementaryCharge() Elementary Electron Charge: e = 1.602176487e-19 (2007 CODATA)
MagneticFluxQuantum() Magnetic Flux Quantum: theta_0 = h/(2*e) (2007 CODATA)
ConductanceQuantum() Conductance Quantum: G_0 = 2*e^2/h (2007 CODATA)
JosephsonConstant() Josephson Constant: K_J = 2*e/h (2007 CODATA)
VonKlitzingConstant() Von Klitzing Constant: R_K = h/e^2 (2007 CODATA)
BohrMagneton() Bohr Magneton: mu_B = e*h_bar/2*m_e (2007 CODATA)
NuclearMagneton() Nuclear Magneton: mu_N = e*h_bar/2*m_p (2007 CODATA)
MathConstantsAtomicLibrary "MathConstantsAtomic"
Mathematical Constants
FineStructureConstant() Fine Structure Constant: alpha = e^2/4*Pi*e_0*h_bar*c_0 (2007 CODATA)
RydbergConstant() Rydberg Constant: R_infty = alpha^2*m_e*c_0/2*h (2007 CODATA)
BohrRadius() Bor Radius: a_0 = alpha/4*Pi*R_infty (2007 CODATA)
HartreeEnergy() Hartree Energy: E_h = 2*R_infty*h*c_0 (2007 CODATA)
QuantumOfCirculation() Quantum of Circulation: h/2*m_e (2007 CODATA)
FermiCouplingConstant() Fermi Coupling Constant: G_F/(h_bar*c_0)^3 (2007 CODATA)
WeakMixingAngle() Weak Mixin Angle: sin^2(theta_W) (2007 CODATA)
ElectronMass() Electron Mass: (2007 CODATA)
ElectronMassEnergyEquivalent() Electron Mass Energy Equivalent: (2007 CODATA)
ElectronMolarMass() Electron Molar Mass: (2007 CODATA)
ComptonWavelength() Electron Compton Wavelength: (2007 CODATA)
ClassicalElectronRadius() Classical Electron Radius: (2007 CODATA)
ThomsonCrossSection() Thomson Cross Section: (2002 CODATA)
ElectronMagneticMoment() Electron Magnetic Moment: (2007 CODATA)
ElectronGFactor() Electon G-Factor: (2007 CODATA)
MuonMass() Muon Mass: (2007 CODATA)
MuonMassEnegryEquivalent() Muon Mass Energy Equivalent: (2007 CODATA)
MuonMolarMass() Muon Molar Mass: (2007 CODATA)
MuonComptonWavelength() Muon Compton Wavelength: (2007 CODATA)
MuonMagneticMoment() Muon Magnetic Moment: (2007 CODATA)
MuonGFactor() Muon G-Factor: (2007 CODATA)
TauMass() Tau Mass: (2007 CODATA)
TauMassEnergyEquivalent() Tau Mass Energy Equivalent: (2007 CODATA)
TauMolarMass() Tau Molar Mass: (2007 CODATA)
TauComptonWavelength() Tau Compton Wavelength: (2007 CODATA)
ProtonMass() Proton Mass: (2007 CODATA)
ProtonMassEnergyEquivalent() Proton Mass Energy Equivalent: (2007 CODATA)
ProtonMolarMass() Proton Molar Mass: (2007 CODATA)
ProtonComptonWavelength() Proton Compton Wavelength: (2007 CODATA)
ProtonMagneticMoment() Proton Magnetic Moment: (2007 CODATA)
ProtonGFactor() Proton G-Factor: (2007 CODATA)
ShieldedProtonMagneticMoment() Proton Shielded Magnetic Moment: (2007 CODATA)
ProtonGyromagneticRatio() Proton Gyro-Magnetic Ratio: (2007 CODATA)
ShieldedProtonGyromagneticRatio() Proton Shielded Gyro-Magnetic Ratio: (2007 CODATA)
NeutronMass() Neutron Mass: (2007 CODATA)
NeutronMassEnegryEquivalent() Neutron Mass Energy Equivalent: (2007 CODATA)
NeutronMolarMass() Neutron Molar Mass: (2007 CODATA)
NeutronComptonWavelength() Neuron Compton Wavelength: (2007 CODATA)
NeutronMagneticMoment() Neutron Magnetic Moment: (2007 CODATA)
NeutronGFactor() Neutron G-Factor: (2007 CODATA)
NeutronGyromagneticRatio() Neutron Gyro-Magnetic Ratio: (2007 CODATA)
DeuteronMass() Deuteron Mass: (2007 CODATA)
DeuteronMassEnegryEquivalent() Deuteron Mass Energy Equivalent: (2007 CODATA)
DeuteronMolarMass() Deuteron Molar Mass: (2007 CODATA)
DeuteronMagneticMoment() Deuteron Magnetic Moment: (2007 CODATA)
HelionMass() Helion Mass: (2007 CODATA)
HelionMassEnegryEquivalent() Helion Mass Energy Equivalent: (2007 CODATA)
HelionMolarMass() Helion Molar Mass: (2007 CODATA)
Avogadro() Avogadro constant: (2010 CODATA)
Vector2OperationsLibrary "Vector2Operations"
functions to handle vector2 operations.
math_fractional(_value) computes the fractional part of the argument value.
Parameters:
_value : float, value to compute.
Returns: float, fractional part.
atan2(_a) Approximation to atan2 calculation, arc tangent of y/ x in the range radians.
Parameters:
_a : vector2 in the form of a array .
Returns: float, value with angle in radians. (negative if quadrante 3 or 4)
set_x(_a, _value) Set the x value of vector _a.
Parameters:
_a : vector2 in the form of a array .
_value : value to replace x value of _a.
Returns: void Modifies vector _a.
set_y(_a, _value) Set the y value of vector _a.
Parameters:
_a : vector in the form of a array .
_value : value to replace y value of _a.
Returns: void Modifies vector _a.
get_x(_a) Get the x value of vector _a.
Parameters:
_a : vector in the form of a array .
Returns: float, x value of the vector _a.
get_y(_a) Get the y value of vector _a.
Parameters:
_a : vector in the form of a array .
Returns: float, y value of the vector _a.
get_xy(_a) Return the tuple of vector _a in the form
Parameters:
_a : vector2 in the form of a array .
Returns:
length_squared(_a) Length of vector _a in the form. , for comparing vectors this is computationaly lighter.
Parameters:
_a : vector in the form of a array .
Returns: float, squared length of vector.
length(_a) Magnitude of vector _a in the form.
Parameters:
_a : vector in the form of a array .
Returns: float, Squared length of vector.
vmin(_a) Lowest element of vector.
Parameters:
_a : vector in the form of a array .
Returns: float
vmax(_a) Highest element of vector.
Parameters:
_a : vector in the form of a array .
Returns: float
from(_value) Assigns value to a new vector x,y elements.
Parameters:
_value : x and y value of the vector. optional.
Returns: float vector.
new(_x, _y) Creates a prototype array to handle vectors.
Parameters:
_x : float, x value of the vector. optional.
_y : float, y number of the vector. optional.
Returns: float vector.
down() Vector in the form . Returns: float vector.
left() Vector in the form . Returns: float vector.
one() Vector in the form . Returns: float vector.
right() Vector in the form . Returns: float vector
up() Vector in the form . Returns: float vector
zero() Vector in the form . Returns: float vector
add(_a, _b) Adds vector _b to _a, in the form
.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns:
subtract(_a, _b) Subtract vector _b from _a, in the form
.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns:
multiply(_a, _b) Multiply vector _a with _b, in the form
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns:
divide(_a, _b) Divide vector _a with _b, in the form
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns:
negate(_a) Negative of vector _a, in the form
Parameters:
_a : vector in the form of a array .
Returns:
perp(_a) Perpendicular Vector of _a.
Parameters:
_a : vector in the form of a array .
Returns:
vfloor(_a) Compute the floor of argument vector _a.
Parameters:
_a : vector in the form of a array .
Returns:
fractional(_a) Compute the fractional part of the elements from vector _a.
Parameters:
_a : vector in the form of a array .
Returns:
vsin(_a) Compute the sine of argument vector _a.
Parameters:
_a : vector in the form of a array .
Returns:
equals(_a, _b) Compares two vectors
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: boolean value representing the equality.
dot(_a, _b) Dot product of 2 vectors, in the form
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float
cross_product(_a, _b) cross product of 2 vectors, in the form
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float
scale(_a, _scalar) Multiply a vector by a scalar.
Parameters:
_a : vector in the form of a array .
_scalar : value to multiply vector elements by.
Returns: float vector
normalize(_a) Vector _a normalized with a magnitude of 1, in the form.
Parameters:
_a : vector in the form of a array .
Returns: float vector
rescale(_a) Rescale a vector to a new Magnitude.
Parameters:
_a : vector in the form of a array .
Returns:
rotate(_a, _radians) Rotates vector _a by angle value
Parameters:
_a : vector in the form of a array .
_radians : Angle value.
Returns:
rotate_degree(_a, _degree) Rotates vector _a by angle value
Parameters:
_a : vector in the form of a array .
_degree : Angle value.
Returns:
rotate_around(_center, _target, _degree) Rotates vector _target around _origin by angle value
Parameters:
_center : vector in the form of a array .
_target : vector in the form of a array .
_degree : Angle value.
Returns:
vceil(_a, _digits) Ceils vector _a
Parameters:
_a : vector in the form of a array .
_digits : digits to use as ceiling.
Returns:
vpow(_a) Raise both vector elements by a exponent.
Parameters:
_a : vector in the form of a array .
Returns:
distance(_a, _b) vector distance between 2 vectors.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float, distance.
project(_a, _axis) Project a vector onto another.
Parameters:
_a : vector in the form of a array .
_axis : float vector2
Returns: float vector
projectN(_a, _axis) Project a vector onto a vector of unit length.
Parameters:
_a : vector in the form of a array .
_axis : vector in the form of a array .
Returns: float vector
reflect(_a, _b) Reflect a vector on another.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float vector
reflectN(_a, _b) Reflect a vector to a arbitrary axis.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float vector
angle(_a) Angle in radians of a vector.
Parameters:
_a : vector in the form of a array .
Returns: float
angle_unsigned(_a, _b) unsigned degree angle between 0 and +180 by given two vectors.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float
angle_signed(_a, _b) Signed degree angle between -180 and +180 by given two vectors.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float
angle_360(_a, _b) Degree angle between 0 and 360 by given two vectors
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
Returns: float
clamp(_a, _vmin, _vmax) Restricts a vector between a min and max value.
Parameters:
_a : vector in the form of a array .
_vmin : vector in the form of a array .
_vmax : vector in the form of a array .
Returns: float vector
lerp(_a, _b, _rate_of_move) Linearly interpolates between vectors a and b by _rate_of_move.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
_rate_of_move : float value between (a:-infinity -> b:1.0), negative values will move away from b.
Returns: vector in the form of a array
herp(_a, _b, _rate_of_move) Hermite curve interpolation between vectors a and b by _rate_of_move.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
_rate_of_move : float value between (a-infinity -> b1.0), negative values will move away from b.
Returns: vector in the form of a array
area_triangle(_a, _b, _c) Find the area in a triangle of vectors.
Parameters:
_a : vector in the form of a array .
_b : vector in the form of a array .
_c : vector in the form of a array .
Returns: float
to_string(_a) Converts vector _a to a string format, in the form "(x, y)"
Parameters:
_a : vector in the form of a array .
Returns: string in "(x, y)" format
vrandom(_max) 2D random value
Parameters:
_max : float vector, vector upper bound
Returns: vector in the form of a array
noise(_a) 2D Noise based on Morgan McGuire @morgan3d
thebookofshaders.com
www.shadertoy.com
Parameters:
_a : vector in the form of a array .
Returns: vector in the form of a array
array_new(_size, _initial_vector) Prototype to initialize a array of vectors.
Parameters:
_size : size of the array.
_initial_vector : vector to be used as default value, in the form of array .
Returns: _vector_array complex Array in the form of a array
array_size(_id) number of vector elements in array.
Parameters:
_id : ID of the array.
Returns: int
array_get(_id, _index) Get the vector in a array, in the form of a array
Parameters:
_id : ID of the array.
_index : Index of the vector.
Returns: vector in the form of a array
array_set(_id, _index, _a) Sets the values vector in a array.
Parameters:
_id : ID of the array.
_index : Index of the vector.
_a : vector, in the form .
Returns: Void, updates array _id.
array_push(_id, _a) inserts the vector at the end of array.
Parameters:
_id : ID of the array.
_a : vector, in the form .
Returns: Void, updates array _id.
array_unshift(_id, _a) inserts the vector at the begining of array.
Parameters:
_id : ID of the array.
_a : vector, in the form .
Returns: Void, updates array _id.
array_pop(_id, _a) removes the last vector of array and returns it.
Parameters:
_id : ID of the array.
_a : vector, in the form .
Returns: vector2, updates array _id.
array_shift(_id, _a) removes the first vector of array and returns it.
Parameters:
_id : ID of the array.
_a : vector, in the form .
Returns: vector2, updates array _id.
array_sum(_id) Total sum of all vectors.
Parameters:
_id : ID of the array.
Returns: vector in the form of a array
array_center(_id) Finds the vector center of the array.
Parameters:
_id : ID of the array.
Returns: vector in the form of a array
array_rotate_points(_id) Rotate Array vectors around origin vector by a angle.
Parameters:
_id : ID of the array.
Returns: rotated points array.
array_scale_points(_id) Scale Array vectors based on a origin vector perspective.
Parameters:
_id : ID of the array.
Returns: rotated points array.
array_tostring(_id, _separator) Reads a array of vectors into a string, of the form " ""
Parameters:
_id : ID of the array.
_separator : string separator for cell splitting.
Returns: string Translated complex array into string.
line_new(_a, _b) 2 vector line in the form.
Parameters:
_a : vector, in the form .
_b : vector, in the form .
Returns:
line_get_a(_line) Start vector of a line.
Parameters:
_line : vector4, in the form .
Returns: float vector2
line_get_b(_line) End vector of a line.
Parameters:
_line : vector4, in the form .
Returns: float vector2
line_intersect(_line1, _line2) Find the intersection vector of 2 lines.
Parameters:
_line1 : line of 2 vectors in the form of a array .
_line2 : line of 2 vectors in the form of a array .
Returns: vector in the form of a array .
draw_line(_line, _xloc, _extend, _color, _style, _width) Draws a line using line prototype.
Parameters:
_line : vector4, in the form .
_xloc : string
_extend : string
_color : color
_style : string
_width : int
Returns: draw line object
draw_triangle(_v1, _v2, _v3, _xloc, _color, _style, _width) Draws a triangle using line prototype.
Parameters:
_v1 : vector4, in the form .
_v2 : vector4, in the form .
_v3 : vector4, in the form .
_xloc : string
_color : color
_style : string
_width : int
Returns: tuple with 3 line objects.
draw_rect(_v1, _size, _angle, _xloc, _color, _style, _width) Draws a square using vector2 line prototype.
Parameters:
_v1 : vector4, in the form .
_size : float
_angle : float
_xloc : string
_color : color
_style : string
_width : int
Returns: tuple with 3 line objects.
HarmonicPatternLibrary "HarmonicPattern"
Functions to detect/check harmonic patterns from provided values.
line_price_rate(point_c, point_b, point_a) Compute the price rate of the line AB divided by the the line BC
Parameters:
point_c : float, the price at point C.
point_b : float, the price at point B.
point_a : float, the price at point A.
Returns: float
line_time_rate(_c, _b, _a) Compute the time rate of the line AB divided by the the line BC
Parameters:
_c : float, the time or bar_index at point C.
_b : float, the time or bar_index at point B.
_a : float, the time or bar_index at point A.
Returns: float
is_inrange(value, min, max) Check if value is within min/max range of tolerance.
Parameters:
value : float, value to check tolerance.
min : float, minimum value in range of tolerance.
max : float, maximum value in range of tolerance.
Returns: bool
isHarmonicTriangle(rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("Harmonic Triangle").
Parameters:
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is2Tap(rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("2Tap", 'Double Top / Bottom').
Parameters:
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is3Tap(rate_edc, rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("3Tap", "Triple Top / Bottom").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is4Tap(rate_gfe, rate_edc, rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("4Tap", "Quadruple Top / Bottom").
Parameters:
rate_gfe : float, percent rate of the triangle GFE. expects a negative rate.
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isABCD(rate_cba, rate_dcb, margin_of_error) Check if the rate(s) correspond to pattern ("AB=CD").
Parameters:
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isBat(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Bat").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isButterfly(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Butterfly").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isGartley(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Gartley").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isCrab(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Crab").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isShark(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Shark").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is5o(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("5o").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isWolfe(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Wolfe").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is3Driver(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("3 Driver").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isConTria(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Contracting Triangle").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isExpTria(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Expanding Triangle").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isHnS(rate_fed, rate_feb, rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Head and Shoulders").
Parameters:
rate_fed : float, percent rate of the triangle FED. expects a negative rate.
rate_feb : float, percent rate of the triangle FEB. expects a negative rate.
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
AnalysisInterpolationLoessLibrary "AnalysisInterpolationLoess"
LOESS, local weighted Smoothing function.
loess(sample_x, sample_y, point_span) LOESS, local weighted Smoothing function.
Parameters:
sample_x : int array, x values.
sample_y : float array, y values.
point_span : int, local point interval span.
aloess(sample_x, sample_y, point_span) aLOESS, adaptive local weighted Smoothing function.
Parameters:
sample_x : int array, x values.
sample_y : float array, y values.
point_span : int, local point interval span.
MathConstantsLibrary "MathConstants"
Mathematical Constants
E() The number e
Log2E() The number log (e)
Log10E() The number log (e)
Ln2() The number log (2)
Ln10() The number log (10)
LnPi() The number log (pi)
Ln2PiOver2() The number log (2*pi)/2
InvE() The number 1/e
SqrtE() The number sqrt(e)
Sqrt2() The number sqrt(2)
Sqrt3() The number sqrt(3)
Sqrt1Over2() The number sqrt(1/2) = 1/sqrt(2) = sqrt(2)/2
HalfSqrt3() The number sqrt(3)/2
Pi() The number pi
Pi2() The number pi*2
PiOver2() The number pi/2
Pi3Over2() The number pi*3/2
PiOver4() The number pi/4
SqrtPi() The number sqrt(pi)
Sqrt2Pi() The number sqrt(2pi)
SqrtPiOver2() The number sqrt(pi/2)
Sqrt2PiE() The number sqrt(2*pi*e)
LogSqrt2Pi() The number log(sqrt(2*pi))
LogSqrt2PiE() The number log(sqrt(2*pi*e))
LogTwoSqrtEOverPi() The number log(2 * sqrt(e / pi))
InvPi() The number 1/pi
TwoInvPi() The number 2/pi
InvSqrtPi() The number 1/sqrt(pi)
InvSqrt2Pi() The number 1/sqrt(2pi)
TwoInvSqrtPi() The number 2/sqrt(pi)
TwoSqrtEOverPi() The number 2 * sqrt(e / pi)
Degree() The number (pi)/180 - factor to convert from Degree (deg) to Radians (rad).
Grad() The number (pi)/200 - factor to convert from NewGrad (grad) to Radians (rad).
PowerDecibel() The number ln(10)/20 - factor to convert from Power Decibel (dB) to Neper (Np). Use this version when the Decibel represent a power gain but the compared values are not powers (e.g. amplitude, current, voltage).
NeutralDecibel() The number ln(10)/10 - factor to convert from Neutral Decibel (dB) to Neper (Np). Use this version when either both or neither of the Decibel and the compared values represent powers.
Catalan() The Catalan constant
Sum(k=0 -> inf){ (-1)^k/(2*k + 1)2 }
EulerMascheroni() The Euler-Mascheroni constant
lim(n -> inf){ Sum(k=1 -> n) { 1/k - log(n) } }
GoldenRatio() The number (1+sqrt(5))/2, also known as the golden ratio
Glaisher() The Glaisher constant
e^(1/12 - Zeta(-1))
Khinchin() The Khinchin constant
prod(k=1 -> inf){1+1/(k*(k+2))^log(k,2)}