FunctionDecisionTreeLibrary "FunctionDecisionTree"
Method to generate decision tree based on weights.
decision_tree(weights, depth) Method to generate decision tree based on weights.
Parameters:
weights : float array, weights for decision consideration.
depth : int, depth of the tree.
Returns: int array
Indicators and strategies
FunctionDaysInMonthLibrary "FunctionDaysInMonth"
Method to find the number of days in a given month of year.
days_in_month(year, month) Method to find the number of days in a given month of year.
Parameters:
year : int, year of month, so we know if year is a leap year or not.
month : int, month number.
Returns: int
[MX]Moving Average - LibraryLibrary "MA_library"
OVERVIEW
This library contains moving average functions that calculate values for which they do not exist by default in PineScript
Functions
tema(source,length) : Triple Exponencial Moving Average
dema(source,length) : Double Exponencial Moving Average
wwma(source,length) : Welles Wilder Moving Average
gma(source,length) : Geometric Moving Average
FunctionForecastLinearLibrary "FunctionForecastLinear"
Method for linear Forecast, same as found in excel and other sheet packages.
forecast(sample_x, sample_y, target_x) linear forecast method.
Parameters:
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.
Returns: float
FunctionBoxCoxTransformLibrary "FunctionBoxCoxTransform"
Methods to compute the Box-Cox Transformer.
regular(sample, lambda) Regular transform.
Parameters:
sample : float array, sample data values.
lambda : float, scaling factor.
Returns: float array.
inverse(sample, lambda) Regular transform.
Parameters:
sample : float array, sample data values.
lambda : float, scaling factor.
Returns: float array.
FunctionPolynomialRegressionLibrary "FunctionPolynomialRegression"
TODO:
polyreg(sample_x, sample_y) Method to return a polynomial regression channel using (X,Y) sample points.
Parameters:
sample_x : float array, sample data X points.
sample_y : float array, sample data Y points.
Returns: tuple with:
_predictions: Array with adjusted Y values.
_max_dev: Max deviation from the mean.
_min_dev: Min deviation from the mean.
_stdev/_sizeX: Average deviation from the mean.
draw(sample_x, sample_y, extend, mid_color, mid_style, mid_width, std_color, std_style, std_width, max_color, max_style, max_width) Method for drawing the Polynomial Regression into chart.
Parameters:
sample_x : float array, sample point X value.
sample_y : float array, sample point Y value.
extend : string, default=extend.none, extend lines.
mid_color : color, default=color.blue, middle line color.
mid_style : string, default=line.style_solid, middle line style.
mid_width : int, default=2, middle line width.
std_color : color, default=color.aqua, standard deviation line color.
std_style : string, default=line.style_dashed, standard deviation line style.
std_width : int, default=1, standard deviation line width.
max_color : color, default=color.purple, max range line color.
max_style : string, default=line.style_dotted, max line style.
max_width : int, default=1, max line width.
Returns: line array.
TimeframeToMinutesLibrary "TimeframeToMinutes"
The timeframeToMinutes() function returns the number of minutes in an arbitrary timeframe string.
timeframeToMinutes()
Returns the number of minutes in the supplied timeframe string, which is arbitrary, i.e. it doesn't have to be the timeframe of the current chart but can be taken from an input.
The sole advantage over the short and neat Pinecoders f_resInMinutes function from their excellent MTF Selection Framework (at ) is that this one doesn't use up a security() call.
To convert the other way, from minutes to timeframe.period format, I would use the f_resFromMinutes function from the Pinecoders' MTF Selection Framework, which does not use security().
ERROR-CHECKING: It has light error-checking to try to make sure the string is in the format timeframe.period, e.g. 15S, 1 (minute), 60 (1H), 1D, 1W, 1M.
It will throw an error for some non-standard timeframes such as 30 hours (1800 minutes). Above 1440 minutes, only whole numbers of days are allowed. This is to be consistent with the security() function.
But it will allow some non-standard timeframes such as 7 hours (420 minutes). Such timeframes must still be supplied in the standard timeframe.period format.
param _tf
The timeframe to convert to minutes. Must be in timeframe.period format.
returns
An integer representing the number of minutes that the timeframe period is equivalent to.
FunctionLinearRegressionLibrary "FunctionLinearRegression"
Method for Linear Regression using array sample points.
linreg(sample_x, sample_y) Performs Linear Regression over the provided sample points.
Parameters:
sample_x : float array, sample points X value.
sample_y : float array, sample points Y value.
Returns: tuple with:
_predictions: Array with adjusted Y values.
_max_dev: Max deviation from the mean.
_min_dev: Min deviation from the mean.
_stdev/_sizeX: Average deviation from the mean.
draw(sample_x, sample_y, extend, mid_color, mid_style, mid_width, std_color, std_style, std_width, max_color, max_style, max_width) Method for drawing the Linear Regression into chart.
Parameters:
sample_x : float array, sample point X value.
sample_y : float array, sample point Y value.
extend : string, default=extend.none, extend lines.
mid_color : color, default=color.blue, middle line color.
mid_style : string, default=line.style_solid, middle line style.
mid_width : int, default=2, middle line width.
std_color : color, default=color.aqua, standard deviation line color.
std_style : string, default=line.style_dashed, standard deviation line style.
std_width : int, default=1, standard deviation line width.
max_color : color, default=color.purple, max range line color.
max_style : string, default=line.style_dotted, max line style.
max_width : int, default=1, max line width.
Returns: line array.
LabelsLibrary "Labels"
Functions to create labels, from simple to complex.
labelSimple()
Creates a label each time a condition is true. All label parameters can be customised.
_condition The condition which must evaluate true for the label to be printed.
_x The x location.
_y The y location.
_text The text to print on the label.
_color The colour of the label.
_textColor The colour of the text.
_style The style of the label.
_yloc The y location type.
Returns
An unnamed label object with the supplied characteristics. To give it a name, assign the output of the function to a label variable, as in the example below.
labelLast()
Creates a label each time a condition is true. All label parameters can be customised. + Option to keep only the most recent label. + Option to display the label a configurable number of bars ahead.
_offset How many bars ahead to draw the label.
_keepLast If true (the default), keeps only the most recent label. If false, prints labels up to the TradingView limit.
_condition The condition which must evaluate true for the label to be printed.
_y The y location.
_text The text to print on the label.
_color The colour of the label.
_textColor The colour of the text.
_style The style of the label.
_yloc The y location type.
Returns A named label object with the supplied characteristics.
labelTextAndFloat()
Creates a label each time a condition is true. All label parameters can be customised. Option to keep only the most recent label. Option to display the label a configurable number of bars ahead; otherwise the x location is fixed at the bar time. + Prints (optional) text and a floating-point number on the next line.
_offset How many bars ahead to draw the label.
_float The floating-point number that you want to display on the label.
_keepLast If true (the default), keeps only the most recent label. If false, prints labels up to the TradingView limit.
_condition The condition which must evaluate true for the label to be printed.
_y The y location.
_text The text to print on the label.
_color The colour of the label.
_textColor The colour of the text.
_style The style of the label.
_yloc The y location type.
Returns A named label object with the supplied characteristics.
labelTextAndFloatSigFig()
Creates a label each time a condition is true. All label parameters can be customised. Option to keep only the most recent label. Option to display the label a configurable number of bars ahead; otherwise the x location is fixed at the bar time. Prints (optional) text and a floating-point number on the next line + to a given number of significant figures.
_offset How many bars ahead to draw the label.
_sigNumFig The number of significant figures to display the floating-point number to.
_float The floating-point number that you want to display on the label.
_keepLast If true (the default), keeps only the most recent label. If false, prints labels up to the TradingView limit.
_condition The condition which must evaluate true for the label to be printed.
_y The y location.
_text The text to print on the label.
_color The colour of the label.
_textColor The colour of the text.
_style The style of the label.
_yloc The y location type.
Returns A named label object with the supplied characteristics.
labelTextAndFloatDecimals()
Creates a label each time a condition is true. All label parameters can be customised. Option to keep only the most recent label. Option to display the label a configurable number of bars ahead. Prints (optional) text and a floating-point number on the next line + to a given number of decimal places.
_offset How many bars ahead to draw the label.
_decimals The number of decimal places to display the floating-point number to.
_float The floating-point number that you want to display on the label.
_keepLast If true (the default), keeps only the most recent label. If false, prints labels up to the TradingView limit.
_condition The condition which must evaluate true for the label to be printed.
_y The y location.
_text The text to print on the label.
_color The colour of the label.
_textColor The colour of the text.
_style The style of the label.
_yloc The y location type.
Returns A named label object with the supplied characteristics.
MathSpecialFunctionsDiscreteFourierTransformLibrary "MathSpecialFunctionsDiscreteFourierTransform"
Method for Complex Discrete Fourier Transform (DFT).
dft(inputs, inverse) Complex Discrete Fourier Transform (DFT).
Parameters:
inputs : float array, pseudo complex array of paired values .
inverse : bool, invert the transformation.
Returns: float array, pseudo complex array of paired values .
raf_BollingerBandsSqueezyLibrary "raf_BollingerBandsSqueezy"
B Bands with some squeese indicating additions
bbands_lines() Calcs BB Returns: the tree lines, upper, basis and lower
bbands_fast_ma() calcs the fast moving average, to be used to compare how prise is positioned against BB Returns: the fast EMA line, and the difference between it and the BB basis line
squeeze_bands_lines() calcs the "squeeze" bands Returns: the squeeze bands upper and lower lines
supertrendHere is an extensive library on different variations of supertrend.
Library "supertrend"
supertrend : Library dedicated to different variations of supertrend
supertrend_atr(length, multiplier, atrMaType, source, highSource, lowSource, waitForClose, delayed) supertrend_atr: Simple supertrend based on atr but also takes into consideration of custom MA Type, sources
Parameters:
length : : ATR Length
multiplier : : ATR Multiplier
atrMaType : : Moving Average type for ATR calculation. This can be sma, ema, hma, rma, wma, vwma, swma
source : : Default is close. Can Chose custom source
highSource : : Default is high. Can also use close price for both high and low source
lowSource : : Default is low. Can also use close price for both high and low source
waitForClose : : Considers source for direction change crossover if checked. Else, uses highSource and lowSource.
delayed : : if set to true lags supertrend atr stop based on target levels.
Returns: dir : Supertrend direction
supertrend : BuyStop if direction is 1 else SellStop
supertrend_bands(bandType, maType, length, multiplier, source, highSource, lowSource, waitForClose, useTrueRange, useAlternateSource, alternateSource, sticky) supertrend_bands: Simple supertrend based on atr but also takes into consideration of custom MA Type, sources
Parameters:
bandType : : Type of band used - can be bb, kc or dc
maType : : Moving Average type for Bands. This can be sma, ema, hma, rma, wma, vwma, swma
length : : Band Length
multiplier : : Std deviation or ATR multiplier for Bollinger Bands and Keltner Channel
source : : Default is close. Can Chose custom source
highSource : : Default is high. Can also use close price for both high and low source
lowSource : : Default is low. Can also use close price for both high and low source
waitForClose : : Considers source for direction change crossover if checked. Else, uses highSource and lowSource.
useTrueRange : : Used for Keltner channel. If set to false, then high-low is used as range instead of true range
useAlternateSource : - Custom source is used for Donchian Chanbel only if useAlternateSource is set to true
alternateSource : - Custom source for Donchian channel
sticky : : if set to true borders change only when price is beyond borders.
Returns: dir : Supertrend direction
supertrend : BuyStop if direction is 1 else SellStop
supertrend_zigzag(length, history, useAlternateSource, alternateSource, source, highSource, lowSource, waitForClose, atrlength, multiplier, atrMaType) supertrend_zigzag: Zigzag pivot based supertrend
Parameters:
length : : Zigzag Length
history : : number of historical pivots to consider
useAlternateSource : - Custom source is used for Zigzag only if useAlternateSource is set to true
alternateSource : - Custom source for Zigzag
source : : Default is close. Can Chose custom source
highSource : : Default is high. Can also use close price for both high and low source
lowSource : : Default is low. Can also use close price for both high and low source
waitForClose : : Considers source for direction change crossover if checked. Else, uses highSource and lowSource.
atrlength : : ATR Length
multiplier : : ATR Multiplier
atrMaType : : Moving Average type for ATR calculation. This can be sma, ema, hma, rma, wma, vwma, swma
Returns: dir : Supertrend direction
supertrend : BuyStop if direction is 1 else SellStop
Algomojo V1.0Library "Algomojo"
This library brings faster access to Automate trades. It simplifies the execution rules and helps
traders to implement faster algo trading strategies.
algomodule()
Bursa_SectorLibrary "Bursa_Sector"
: List of stocks classified by sector in Bursa Malaysia (As of Oct 2021)
getSector()
This function will get the sector of current stock that listed in Bursa Malaysia
zigzag⬜ Zigzag at your fingertips.
Creating zigzag array is more simpler than ever. All you need to do is:
▶ Import library:
import HeWhoMustNotBeNamed// as zgi
▶ And invoke zigzag to get all the details.
zgi.drawzigzag(zigzagLength)
More examples in the code where you can get retracement ratios, zigzag direction, divergence etc.
Library "zigzag"
Library dedicated to zigzags and related indicators
zigzag(length, numberOfPivots, useAlternativeSource, source, oscillatorSource, directionBias) zigzag: Calculates zigzag pivots and generates an array
Parameters:
length : : Zigzag Length
numberOfPivots : : Max number of pivots to return in the array. Default is 20
useAlternativeSource : : If set uses the source for genrating zigzag. Default is false
source : : Alternative source used only if useAlternativeSource is set to true. Default is close
oscillatorSource : : Oscillator source for calculating divergence
directionBias : : Direction bias for calculating divergence
Returns:
zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs : Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
newPivot : Returns true if new pivot created
doublePivot : Returns true if two new pivots are created on same bar (Happens in case of candles with long wicks and shorter zigzag lengths)
drawzigzag(length, numberOfPivots, , source, linecolor, linewidth, linestyle, oscillatorSource, directionBias, showHighLow, showRatios, showDivergence) drawzigzag: Calculates and draws zigzag pivots
Parameters:
length : : Zigzag Length
numberOfPivots : : Max number of pivots to return in the array. Default is 20
: useAlternativeSource: If set uses the source for genrating zigzag. Default is false
source : : Alternative source used only if useAlternativeSource is set to true. Default is close
linecolor : : zigzag line color
linewidth : : zigzag line width
linestyle : : zigzag line style
oscillatorSource : : Oscillator source for calculating divergence
directionBias : : Direction bias for calculating divergence
showHighLow : : show highlow label
showRatios : : show retracement ratios
showDivergence : : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
Returns:
zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs : Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
CreateAndShowZigzagLibrary "CreateAndShowZigzag"
Functions in this library creates/updates zigzag array and shows the zigzag
getZigzag(zigzag, prd, max_array_size) calculates zigzag using period
Parameters:
zigzag : is the float array for the zigzag (should be defined like "var zigzag = array.new_float(0)"). each zigzag points contains 2 element: 1. price level of the zz point 2. bar_index of the zz point
prd : is the length to calculate zigzag waves by highest(prd)/lowest(prd)
max_array_size : is the maximum number of elements in zigzag, keep in mind each zigzag point contains 2 elements, so for example if it's 10 then zigzag has 10/2 => 5 zigzag points
Returns: dir that is the current direction of the zigzag
showZigzag(zigzag, oldzigzag, dir, upcol, dncol) this function shows zigzag
Parameters:
zigzag : is the float array for the zigzag (should be defined like "var zigzag = array.new_float(0)"). each zigzag points contains 2 element: 1. price level of the zz point 2. bar_index of the zz point
oldzigzag : is the float array for the zigzag, you get copy the zigzag array to oldzigzag by "oldzigzag = array.copy(zigzay)" before calling get_zigzag() function
dir : is the direction of the zigzag wave
upcol : is the color of the line if zigzag direction is up
dncol : is the color of the line if zigzag direction is down
Returns: null
MathComplexEvaluateLibrary "MathComplexEvaluate"
TODO: add library description here
is_op(char) Check if char is a operator.
Parameters:
char : string, 1 character string.
Returns: bool.
operator(op, left, right) operation between left and right values.
Parameters:
op : string, operator string character.
left : float, left value of operation.
right : float, right value of operation.
operator_precedence(op) level of precedence of operator.
Parameters:
op : string, operator 1 char string.
Returns: int.
eval() evaluate a string with references to a array of arguments.
| @param tokens string, arithmetic operations with references to indices in arguments, ex:"0+1*0+2*2+3" arguments
| @param arguments float array, arguments.
| @returns float, solution.
MathComplexTrignometryLibrary "MathComplexTrignometry"
Methods for complex number trignometry operations.
sinh(complex) Hyperbolic Sine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
cosh(complex) Hyperbolic cosine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
tanh(complex) Hyperbolic tangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
coth(complex) Hyperbolic cotangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
sech(complex) Hyperbolic Secant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
csch(complex) Hyperbolic Cosecant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
sin(complex) Trigonometric Sine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
cos(complex) Trigonometric cosine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
tan(complex) Trigonometric tangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
cot(complex) Trigonometric cotangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
sec(complex) Trigonometric Secant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
csc(complex) Trigonometric Cosecant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
asin(complex) Trigonometric Arc Sine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
acos(complex) Trigonometric Arc Cosine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
atan(complex) Trigonometric Arc Tangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
acot(complex) Trigonometric Arc Cotangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
asec(complex) Trigonometric Arc Secant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
acsc(complex) Trigonometric Arc Cosecant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
asinh(complex) Hyperbolic Arc Sine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
acosh(complex) Hyperbolic Arc Cosine of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
atanh(complex) Hyperbolic Arc Tangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
acoth(complex) Hyperbolic Arc Cotangent of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
asech(complex) Hyperbolic Arc Secant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
acsch(complex) Hyperbolic Arc Cosecant of complex number.
Parameters:
complex : float array, complex number.
Returns: float array.
MathComplexExtensionLibrary "MathComplexExtension"
A set of utility functions to handle complex numbers.
get_phase(complex_number, in_radians) The phase value of complex number complex_number.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
in_radians : boolean, value for the type of angle value, default=true, options=(true: radians, false: degrees)
Returns: float value with phase.
natural_logarithm(complex_number) Natural logarithm of complex number (base E).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, complex number.
common_logarithm(complex_number) Common logarithm of complex number (base 10).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, complex number.
logarithm(complex_number, base) Common logarithm of complex number (custom base).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
base : float, base value.
Returns: float array, complex number.
power(complex_number, complex_exponent) Raise complex_number with complex_exponent.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
complex_exponent : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
root(complex_number, complex_exponent) Raise complex_number with inverse of complex_exponent.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
complex_exponent : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
square(complex_number) Square of complex_number (power 2).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
square_root(complex_number) Square root of complex_number (power 1/2).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
square_roots(complex_number) Square root of complex_number (power 1/2).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: tuple with 2 complex numbers.
cubic_roots(complex_number) Square root of complex_number (power 1/2).
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: tuple with 2 complex numbers.
to_polar_form(complex_number, in_radians) The polar form value of complex_number.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
in_radians : boolean, value for the type of angle value, default=true, options=(true: radians, false: degrees)
Returns: float array, pseudo complex number in the form of a array
** returns a array
MathComplexOperatorLibrary "MathComplexOperator"
A set of utility functions to handle complex numbers.
conjugate(complex_number) Computes the conjugate of complex_number by reversing the sign of the imaginary part.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
add(complex_number_a, complex_number_b) Adds complex number complex_number_b to complex_number_a, in the form:
.
Parameters:
complex_number_a : pseudo complex number in the form of a array .
complex_number_b : pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
subtract(complex_number_a, complex_number_b) Subtract complex_number_b from complex_number_a, in the form:
.
Parameters:
complex_number_a : float array, pseudo complex number in the form of a array .
complex_number_b : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
multiply(complex_number_a, complex_number_b) Multiply complex_number_a with complex_number_b, in the form:
Parameters:
complex_number_a : float array, pseudo complex number in the form of a array .
complex_number_b : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
divide(complex_number_a, complex_number_b) Divide complex_number _a with _b, in the form:
Parameters:
complex_number_a : float array, pseudo complex number in the form of a array .
complex_number_b : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
reciprocal(complex_number) Computes the reciprocal or inverse of complex_number.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
negative(complex_number) Negative of complex_number, in the form:
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
inverse(complex_number) Inverse of complex_number, in the form:
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
exponential(complex_number) Exponential of complex_number.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: float array, pseudo complex number in the form of a array
ceil(complex_number, digits) Ceils complex_number.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
digits : int, digits to use as ceiling.
Returns: _complex: pseudo complex number in the form of a array
radius(complex_number) Radius(magnitude) of complex_number, in the form:
This is defined as its distance from the origin (0,0) of the complex plane.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float value with radius.
magnitude(complex_number) magnitude(absolute value) of complex_number, should be the same as the radius.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float.
magnitude_squared(complex_number) magnitude(absolute value) of complex_number, should be the same as the radius.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float.
sign(complex_number) Unity of complex numbers.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
Returns: float array, complex number.
MathComplexArrayLibrary "MathComplexArray"
Array methods to handle complex number arrays.
new(size, initial_complex) Prototype to initialize a array of complex numbers.
Parameters:
size : size of the array.
initial_complex : Complex number to be used as default value, in the form of array .
Returns: float array, pseudo complex Array in the form of a array
get(id, index) Get the complex number in a array, in the form of a array
Parameters:
id : float array, ID of the array.
index : int, Index of the complex number.
Returns: float array, pseudo complex number in the form of a array
set(id, index, complex_number) Sets the values complex number in a array.
Parameters:
id : float array, ID of the array.
index : int, Index of the complex number.
complex_number : float array, Complex number, in the form: .
Returns: Void, updates array id.
push(id, complex_number) Push the values into a complex number array.
Parameters:
id : float array, ID of the array.
complex_number : float array, Complex number, in the form: .
Returns: Void, updates array id.
pop(id, complex_number) Pop the values from a complex number array.
Parameters:
id : float array, ID of the array.
complex_number : float array, Complex number, in the form: .
Returns: Void, updates array id.
to_string(id, format) Reads a array of complex numbers into a string, of the form: " [ , ... ]""
Parameters:
id : float array, ID of the array.
format : string, format of the number conversion, default='#.##########'.
Returns: string, translated complex array into string.
MathComplexCoreLibrary "MathComplexCore"
Core functions to handle complex numbers.
set_real(complex_number, real) Set the real part of complex_number.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
real : float, value to replace real value of complex_number.
Returns: Void, Modifies complex_number.
set_imaginary(complex_number, imaginary) Set the imaginary part of complex_number.
Parameters:
complex_number : float array, pseudo complex number in the form of a array .
imaginary : float, value to replace imaginary value of complex_number.
Returns: Void, Modifies complex_number.
new(real, imaginary) Creates a prototype array to handle complex numbers.
Parameters:
real : float, real value of the complex number. default=0.
imaginary : float, imaginary number of the complex number. default=0.
@return float array, pseudo complex number in the form of a array .
zero() complex number "0+0i".
@return float array, pseudo complex number in the form of a array .
one() complex number "1+0i".
@return float array, pseudo complex number in the form of a array .
imaginary_one() complex number "0+1i".
@return float array, pseudo complex number in the form of a array .
nan() complex number "0+1i".
@return float array, pseudo complex number in the form of a array .
from_polar_coordinates(magnitude, phase) Create a complex number from a point's polar coordinates.
Parameters:
magnitude : float, default=0.0, The magnitude, which is the distance from the origin (the intersection of the x-axis and the y-axis) to the number.
phase : float, default=0.0, The phase, which is the angle from the line to the horizontal axis, measured in radians.
@return float array, pseudo complex number in the form of a array .
get_real(complex_number) Get the real part of complex_number.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: float, Real part of the complex_number.
get_imaginary(complex_number) Get the imaginary part of complex_number.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: float, Imaginary part of the complex number.
is_complex(complex_number) Checks that its a valid complex_number.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: bool.
is_nan(complex_number) Checks that its empty "na" complex_number.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: bool.
is_real(complex_number) Checks that the complex_number is real.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: bool.
is_real_non_negative(complex_number) Checks that the complex_number is real and not negative.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: bool.
is_zero(complex_number) Checks that the complex_number is zero.
Parameters:
complex_number : pseudo complex number in the form of a array .
Returns: bool.
equals(complex_number_a, complex_number_b) Compares two complex numbers:
Parameters:
complex_number_a : float array, pseudo complex number in the form of a array .
complex_number_b : float array, pseudo complex number in the form of a array .
Returns: boolean value representing the equality.
to_string(complex, format) Converts complex_number to a string format, in the form: "a+bi"
Parameters:
complex : pseudo complex number in the form of a array .
format : string, formating to apply.
Returns: a string in "a+bi" format
FunctionBestFitFrequencyLibrary "FunctionBestFitFrequency"
TODO: add library description here
array_moving_average(sample, length, ommit_initial, fillna) Moving Average values for selected data.
Parameters:
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 length.
fillna : string, default='na', options='na', '0', 'avg'
Returns: float array
errors:
length > sample size "Canot call array methods when id of array is na."
best_fit_frequency(sample, start, end) Search a frequency range for the fairest moving average frequency.
Parameters:
sample : float array, sample data to based the moving averages.
start : int lowest frequency.
end : int highest frequency.
Returns: tuple with (int frequency, float percentage)