string_utilsLibrary "string_utils"
Collection of string utilities that can be used to replace sub-strings in a string and string functions
that are not part of the standard library.
This a more simple replacement of my previous string_variables library since it uses types for better
performance due to data locality and methods that give a more intuitive API.
Variable
TurntLibraryLibrary "TurntLibrary"
Collection of functions created for simplification/easy referencing. Includes variations of moving averages, length value oscillators, and a few other simple functions based upon HH/LL values.
ma(source, length, type)
Apply a moving average to a float value
Parameters:
source : Value to be used
length : Number of bars to include in calculation
type : Moving average type to use ("SMA","EMA","RMA","WMA","VWAP","SWMA","LRC")
Returns: Smoothed value of initial float value
curve(src, len, lb1, lb2)
Exaggerates curves of a float value designed for use as an exit signal.
Parameters:
src : Initial value to curve
len : Number of bars to include in calculation
lb1 : (Default = 1) First lookback length
lb2 : (Default = 2) Second lookback length
Returns: Curved Average
fragma(src, len, space, str)
Average of a moving average and the previous value of the moving average
Parameters:
src : Initial float value to use
len : Number of bars to include in calculation
space : Lookback integer for second half of average
str : Moving average type to use ("SMA","EMA","RMA","WMA","VWAP","SWMA","LRC")
Returns: Fragmented Average
maxmin(x, y)
Difference of 2 float values, subtracting the lowest from the highest
Parameters:
x : Value 1
y : Value 2
Returns: The +Difference between 2 float values
oscLen(val, type)
Variable Length using a oscillator value and a corresponding slope shape ("Incline",Decline","Peak","Trough")
Parameters:
val : Oscillator Value to use
type : Slope of length curve ("Incline",Decline","Peak","Trough")
Returns: Variable Length Integer
hlAverage(val, smooth, max, min, type, include)
Average of HH,LL with variable lengths based on the slope shape ("Incline","Decline","Trough") value relative to highest and lowest
Parameters:
val : Source Value to use
smooth
max
min
type
include : Add "val" to the averaging process, instead of more weight to highest or lowest value
Returns: Variable Length Average of Highest Lowest "val"
pct(val)
Convert a positive float / price to a percentage of it's highest value on record
Parameters:
val : Value To convert to a percentage of it's highest value ever
Returns: Percentage
hlrange(x, len)
Difference between Highest High and Lowest Low of float value
Parameters:
x : Value to use in calculation
len : Number of bars to include in calculation
Returns: Difference
midpoint(x, len, smooth)
The average value of the float's Highest High and Lowest Low in a number of bars
Parameters:
x : Value to use in calculation
len
smooth : (Default=na) Optional smoothing type to use ("SMA","EMA","RMA","WMA","VWAP","SWMA","LRC")
Returns: Midpoint
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)}