Branch CurveLibrary   "branch" 
Generates a branch made of segments with a starting angle
and a turning angle for each segment. The branch is generated from a starting point
and a number of nodes to generate. The length of each segment and angle of each segment
can be adjusted. The branch can be generated in 2D or 3D, render as you wish.
 method branch(origin, nodes, segment_length, segment_growth, angle_start, angle_turn) 
  # Branch Generation.
- `origin`: CommonTypesMath.Vector3 - The starting point of the branch. If the z value is not zero, it will be used as the starting angle.
- `nodes`: int - The number of nodes to generate.
- `segment_length`: float - The length of each segment.
- `segment_growth`: float - The growth of each segment. 0 = no growth, 100 = double the length of the previous segment.
- `angle_start`: float - The starting angle of the branch in degrees.
- `angle_turn`: float - The turning angle of each segment in degrees.
  Namespace types: CommonTypesMath.Vector3
  Parameters:
     origin (Vector3 type from RicardoSantos/CommonTypesMath/1) : The starting point of the branch. If the z value is not zero, it will be used as the starting angle.
     nodes (int) : The number of nodes to generate.
     segment_length (float) : The length of each segment.
     segment_growth (float) : The growth of each segment. 0 = no growth, 100 = double the length of the previous segment.
     angle_start (float) : The starting angle of the branch in degrees.
     angle_turn (float) : The turning angle of each segment in degrees.
@return segments The list of segments that make up the branch.
Arrays
HarmonicPatternTrackingLibrary   "HarmonicPatternTracking" 
Library contains few data structures and methods for tracking harmonic pattern trades via pinescript.
 method draw(this) 
  Creates and draws HarmonicDrawing object for given HarmonicPattern
  Namespace types: HarmonicPattern
  Parameters:
     this (HarmonicPattern) : HarmonicPattern object
  Returns: current HarmonicPattern object
 method addTrade(this) 
  calculates HarmonicTrade and sets trade object for HarmonicPattern
  Namespace types: HarmonicPattern
  Parameters:
     this (HarmonicPattern) : HarmonicPattern object
  Returns: bool true if pattern trades are valid, false otherwise
 method delete(this) 
  Deletes drawing objects of HarmonicDrawing
  Namespace types: HarmonicDrawing
  Parameters:
     this (HarmonicDrawing) : HarmonicDrawing object
  Returns: current HarmonicDrawing object
 method delete(this) 
  Deletes drawings of harmonic pattern
  Namespace types: HarmonicPattern
  Parameters:
     this (HarmonicPattern) : HarmonicPattern object
  Returns: current HarmonicPattern object
 HarmonicDrawing 
  Drawing objects of Harmonic Pattern
  Fields:
     xa (series line) : xa line
     ab (series line) : ab line
     bc (series line) : bc line
     cd (series line) : cd line
     xb (series line) : xb line
     bd (series line) : bd line
     ac (series line) : ac line
     xd (series line) : xd line
     x (series label) : label for pivot x
     a (series label) : label for pivot a
     b (series label) : label for pivot b
     c (series label) : label for pivot c
     d (series label) : label for pivot d
     xabRatio (series label) : label for XAB Ratio
     abcRatio (series label) : label for ABC Ratio
     bcdRatio (series label) : label for BCD Ratio
     xadRatio (series label) : label for XAD Ratio
 HarmonicTrade 
  Trade tracking parameters of Harmonic Patterns
  Fields:
     initialEntry (series float) : initial entry when pattern first formed.
     entry (series float) : trailed entry price.
     initialStop (series float) : initial stop when trade first entered.
     stop (series float) : current stop updated as per trailing rules.
     target1 (series float) : First target value
     target2 (series float) : Second target value
     target3 (series float) : Third target value
     target4 (series float) : Fourth target value
     status (series int) : Trade status referenced as integer
     retouch (series bool) : Flag to show if the price retouched after entry
 HarmonicProperties 
  Display and trade calculation properties for Harmonic Patterns
  Fields:
     fillMajorTriangles (series bool) : Display property used for using linefill for harmonic major triangles
     fillMinorTriangles (series bool) : Display property used for using linefill for harmonic minor triangles
     majorFillTransparency (series int) : transparency setting for major triangles
     minorFillTransparency (series int) : transparency setting for minor triangles
     showXABCD (series bool) : Display XABCD pivot labels
     lblSizePivots (series string) : Pivot label size
     showRatios (series bool) : Display Ratio labels
     useLogScaleForScan (series bool) : Use log scale to determine fib ratios for pattern scanning
     useLogScaleForTargets (series bool) : Use log scale to determine fib ratios for target calculation
     base (series string) : base on which calculation of stop/targets are made.
     entryRatio (series float) : fib ratio to calculate entry
     stopRatio (series float) : fib ratio to calculate initial stop
     target1Ratio (series float) : fib ratio to calculate first target
     target2Ratio (series float) : fib ratio to calculate second target
     target3Ratio (series float) : fib ratio to calculate third target
     target4Ratio (series float) : fib ratio to calculate fourth target
 HarmonicPattern 
  Harmonic pattern object to track entire pattern trade life cycle
  Fields:
     id (series int) : Pattern Id
     dir (series int) : pattern direction
     x (series float) : X Pivot
     a (series float) : A Pivot
     b (series float) : B Pivot
     c (series float) : C Pivot
     d (series float) : D Pivot
     xBar (series int) : Bar index of X Pivot
     aBar (series int) : Bar index of A Pivot
     bBar (series int) : Bar index of B Pivot
     cBar (series int) : Bar index of C Pivot
     dBar (series int) : Bar index of D Pivot
     przStart (series float) : Start of PRZ range
     przEnd (series float) : End of PRZ range
     patterns (bool ) : array representing the patterns
     patternLabel (series string) : string representation of list of patterns
     patternColor (series color) : color assigned to pattern
     properties (HarmonicProperties) : HarmonicProperties object containing display and calculation properties
     trade (HarmonicTrade) : HarmonicTrade object to track trades
     drawing (HarmonicDrawing) : HarmonicDrawing object to manage drawings
MarkovAlgorithmLibrary   "MarkovAlgorithm" 
Markov algorithm is a string rewriting system that uses grammar-like rules to operate on strings of 
symbols. Markov algorithms have been shown to be Turing-complete, which means that they are suitable as a 
general model of computation and can represent any mathematical expression from its simple notation. 
~ wikipedia
.
reference:
en.wikipedia.org
rosettacode.org
 parse(rules, separator) 
  Parameters:
     rules (string) 
     separator (string) 
  Returns: - `array _rules`: List of rules.
---
Usage:
- `parse("|0 -> 0|| 1 -> 0| 0 -> ")`
 apply(expression, rules) 
  Aplies rules to a expression.
  Parameters:
     expression (string) : `string`: Text expression to be formated by the rules.
     rules (rule ) : `string`: Rules to apply to expression on a string format to be parsed.
  Returns: - `string _result`: Formated expression.
---
Usage:
- `apply("101", parse("|0 -> 0|| 1 -> 0| 0 -> "))`
 apply(expression, rules) 
  Parameters:
     expression (string) 
     rules (string) 
  Returns: - `string _result`: Formated expression.
---
Usage:
- `apply("101", parse("|0 -> 0|| 1 -> 0| 0 -> "))`
 rule 
  String pair that represents `pattern -> replace`, each rule may be ordinary or terminating.
  Fields:
     pattern (series string) : Pattern to replace.
     replacement (series string) : Replacement patterns.
     termination (series bool) : Termination rule.
FunctionBaumWelchLibrary   "FunctionBaumWelch" 
Baum-Welch Algorithm, also known as Forward-Backward Algorithm, uses the well known EM algorithm 
to find the maximum likelihood estimate of the parameters of a hidden Markov model given a set of observed 
feature vectors. 
---
### Function List:
> `forward (array pi, matrix a, matrix b, array obs)`
> `forward (array pi, matrix a, matrix b, array obs, bool scaling)`
> `backward (matrix a, matrix b, array obs)`
> `backward (matrix a, matrix b, array obs, array c)`
> `baumwelch (array observations, int nstates)`
> `baumwelch (array observations, array pi, matrix a, matrix b)`
---
### Reference:
> en.wikipedia.org
> github.com
> en.wikipedia.org
> www.rdocumentation.org
> www.rdocumentation.org
 forward(pi, a, b, obs) 
  Computes forward probabilities for state `X` up to observation at time `k`, is defined as the
probability of observing sequence of observations `e_1 ... e_k` and that the state at time `k` is `X`.
  Parameters:
     pi (float ) : Initial probabilities.
     a (matrix) : Transmissions, hidden transition matrix a or alpha = transition probability matrix of changing 
states given a state matrix is size (M x M) where M is number of states.
     b (matrix) : Emissions, matrix of observation probabilities b or beta = observation probabilities. Given 
state matrix is size (M x O) where M is number of states and O is number of different 
possible observations.
     obs (int ) : List with actual state observation data.
  Returns: - `matrix _alpha`: Forward probabilities. The probabilities are given on a logarithmic scale (natural logarithm). The first 
dimension refers to the state and the second dimension to time.
 forward(pi, a, b, obs, scaling) 
  Computes forward probabilities for state `X` up to observation at time `k`, is defined as the
probability of observing sequence of observations `e_1 ... e_k` and that the state at time `k` is `X`.
  Parameters:
     pi (float ) : Initial probabilities.
     a (matrix) : Transmissions, hidden transition matrix a or alpha = transition probability matrix of changing 
states given a state matrix is size (M x M) where M is number of states.
     b (matrix) : Emissions, matrix of observation probabilities b or beta = observation probabilities. Given 
state matrix is size (M x O) where M is number of states and O is number of different 
possible observations.
     obs (int ) : List with actual state observation data.
     scaling (bool) : Normalize `alpha` scale.
  Returns: - #### Tuple with:
> - `matrix _alpha`: Forward probabilities. The probabilities are given on a logarithmic scale (natural logarithm). The first 
dimension refers to the state and the second dimension to time.
> - `array _c`: Array with normalization scale.
 backward(a, b, obs) 
  Computes backward probabilities for state `X` and observation at time `k`, is defined as the probability of observing the sequence of observations `e_k+1, ... , e_n` under the condition that the state at time `k` is `X`.
  Parameters:
     a (matrix) : Transmissions, hidden transition matrix a or alpha = transition probability matrix of changing states
given a state matrix is size (M x M) where M is number of states
     b (matrix) : Emissions, matrix of observation probabilities b or beta = observation probabilities. given state 
matrix is size (M x O) where M is number of states and O is number of different possible observations
     obs (int ) : Array with actual state observation data.
  Returns: - `matrix _beta`: Backward probabilities. The probabilities are given on a logarithmic scale (natural logarithm). The first dimension refers to the state and the second dimension to time.
 backward(a, b, obs, c) 
  Computes backward probabilities for state `X` and observation at time `k`, is defined as the probability of observing the sequence of observations `e_k+1, ... , e_n` under the condition that the state at time `k` is `X`.
  Parameters:
     a (matrix) : Transmissions, hidden transition matrix a or alpha = transition probability matrix of changing states
given a state matrix is size (M x M) where M is number of states
     b (matrix) : Emissions, matrix of observation probabilities b or beta = observation probabilities. given state 
matrix is size (M x O) where M is number of states and O is number of different possible observations
     obs (int ) : Array with actual state observation data.
     c (float ) : Array with Normalization scaling coefficients.
  Returns: - `matrix _beta`: Backward probabilities. The probabilities are given on a logarithmic scale (natural logarithm). The first dimension refers to the state and the second dimension to time.
 baumwelch(observations, nstates) 
  **(Random Initialization)** Baum–Welch algorithm is a special case of the expectation–maximization algorithm used to find the
unknown parameters of a hidden Markov model (HMM). It makes use of the forward-backward algorithm 
to compute the statistics for the expectation step.
  Parameters:
     observations (int ) : List of observed states.
     nstates (int) 
  Returns: - #### Tuple with:
> - `array _pi`: Initial probability distribution.
> - `matrix _a`: Transition probability matrix.
> - `matrix _b`: Emission probability matrix.
---
requires: `import RicardoSantos/WIPTensor/2 as Tensor`
 baumwelch(observations, pi, a, b) 
  Baum–Welch algorithm is a special case of the expectation–maximization algorithm used to find the
unknown parameters of a hidden Markov model (HMM). It makes use of the forward-backward algorithm 
to compute the statistics for the expectation step.
  Parameters:
     observations (int ) : List of observed states.
     pi (float ) : Initial probaility distribution.
     a (matrix) : Transmissions, hidden transition matrix a or alpha = transition probability matrix of changing states
given a state matrix is size (M x M) where M is number of states
     b (matrix) : Emissions, matrix of observation probabilities b or beta = observation probabilities. given state 
matrix is size (M x O) where M is number of states and O is number of different possible observations
  Returns: - #### Tuple with:
> - `array _pi`: Initial probability distribution.
> - `matrix _a`: Transition probability matrix.
> - `matrix _b`: Emission probability matrix.
---
requires: `import RicardoSantos/WIPTensor/2 as Tensor`
Scaled Order Sizing and Take Profit Target ArraysWOAH Order Scaling! 
This Provides a user with methods to create a list of profit targets and order sizes which grow or shrink. For size, the will add up to  specific sum. for Targets they will include the first and last, and can lean towards either, to scale the order grid.
And thanks to @Hoanghetti for the markdown, i've included a basic usage example within the hover , o you don't need to search for the usage example, simply  import, and when writing, the code hint contains a full example.
 scaled_sizes(total_size, count, weight, min_size, as_percent) 
create an array of sizes which grow or shrink from first to last
which add up to 1.0 if set the as_percent flag , or a total value / sum.
  Parameters:
     total_size : (float)  total size to divide ito split
     count : (int  )  desired number of splits to create
     weight : (float)  a weight to apply to grow or shrink the split either towards the last being most, or the first being most, or 1.0 being each is equally sized as  1/n count
     min_size : (float)  a minimum size for the smallest value (in value of ttotal_size units)
     as_percent : (float)  a minimum size for the smallest value (in value of total_size units)
  Returns: Array of  Sizes for each split
 scaled_targets(count, weight, minimum, maximum) 
create a list of take profitt targets from the smallest to larget distance
  Parameters:
     count : (int  ) number of targets
     weight : (float) weight to apply to growing or shrinking
     minimum : (float) first value of the output
     maximum : (float) last value of the output
  Returns: Array of percentage targets
WIPTensorLibrary   "WIPTensor" 
A Tensor or 3 dimensional array structure and interface.
---
Note: im just highjacking the name to use it as a 3d array on a project..
there is no optimization attempts or tensor specific functionality within.
 to_string(this) 
  Convert `Tensor` to a string format.
  Parameters:
     this : Tensor data.
  Returns: string.
 to_vector(this) 
  Convert `Tensor` to a one dimension array.
  Parameters:
     this : Tensor data.
  Returns: New array with flattened `Tensor` data.
 new(x, y, z, initial_value) 
  Create a new `Tensor` with provided shape.
  Parameters:
     x : Dimension `X` size.
     y : Dimension `Y` size.
     z : Dimension `Z` size.
     initial_value : Value to fill the `Tensor`.
  Returns: New `Tensor`.
 new(shape, initial_value) 
  Create a new `Tensor` with provided shape.
  Parameters:
     shape : Shape of dimensions size.
     initial_value : Value to fill the `Tensor`.
  Returns: New `Tensor`.
 from(expression, sepx, sepy, sepz) 
  Create a `Tensor` from provided array and shape.
  Parameters:
     expression 
     sepx 
     sepy 
     sepz 
  Returns: New `Tensor`.
 from(vector, x, y, z) 
  Create a `Tensor` from provided array and shape.
  Parameters:
     vector : Data with flattened dimensions.
     x 
     y 
     z 
  Returns: New `Tensor`.
 from(vector, shape) 
  Parameters:
     vector 
     shape 
 get(this, x, y, z) 
  Get the value at position.
  Parameters:
     this : `Tensor` data.
     x 
     y 
     z 
  Returns: Value at position.
 get(this, position) 
  Parameters:
     this 
     position 
 set(this, x, y, z, value) 
  Set the value at position.
  Parameters:
     this : `Tensor` data.
     x 
     y 
     z 
     value : New Value.
 set(this, position, value) 
  Parameters:
     this 
     position 
     value 
 Vector 
  Helper type for 3d structure.
  Fields:
     v : Vector of the 3rd dimension.
 Tensor 
  A Tensor is a three dimensional array were the 3rd dimension accounts for time.
  Fields:
     m : Matrix that holds the vectors.
Bitwise, Encode, DecodeLibrary   "Bitwise, Encode, Decode" 
Bitwise, Encode, Decode, and more Library
 docs() 
      Hover-Over Documentation for inside Text Editor
 bAnd(a, b) 
  Returns the bitwise AND of two integers  
  Parameters:
     a : `int` - The first integer
     b : `int` - The second integer
  Returns: `int` - The bitwise AND of the two integers
 bOr(a, b) 
  Performs a bitwise OR operation on two integers.  
  Parameters:
     a : `int` - The first integer.
     b : `int` - The second integer.
  Returns: `int` - The result of the bitwise OR operation.
 bXor(a, b) 
  Performs a bitwise Xor operation on two integers.  
  Parameters:
     a : `int` - The first integer.
     b : `int` - The second integer.
  Returns: `int` - The result of the bitwise Xor operation.
 bNot(n) 
  Performs a bitwise NOT operation on an integer.  
  Parameters:
     n : `int` - The integer to perform the bitwise NOT operation on.
  Returns: `int` - The result of the bitwise NOT operation.
 bShiftLeft(n, step) 
  Performs a bitwise left shift operation on an integer.  
  Parameters:
     n : `int` - The integer to perform the bitwise left shift operation on.
     step : `int` - The number of positions to shift the bits to the left.
  Returns: `int` - The result of the bitwise left shift operation.
 bShiftRight(n, step) 
  Performs a bitwise right shift operation on an integer.  
  Parameters:
     n : `int` - The integer to perform the bitwise right shift operation on.
     step : `int` - The number of bits to shift by.
  Returns: `int` - The result of the bitwise right shift operation.
 bRotateLeft(n, step) 
  Performs a bitwise right shift operation on an integer.
  Parameters:
     n : `int` - The int to perform the bitwise Left rotation on the bits.                        
     step : `int` - The number of bits to shift by.
  Returns: `int`- The result of the bitwise right shift operation.
 bRotateRight(n, step) 
  Performs a bitwise right shift operation on an integer.
  Parameters:
     n : `int` - The int to perform the bitwise Right rotation on the bits.
     step : `int` - The number of bits to shift by.
  Returns: `int` - The result of the bitwise right shift operation.
 bSetCheck(n, pos) 
  Checks if the bit at the given position is set to 1.
  Parameters:
     n : `int` - The integer to check.
     pos : `int` - The position of the bit to check.
  Returns: `bool` - True if the bit is set to 1, False otherwise.
 bClear(n, pos) 
  Clears a particular bit of an integer (changes from 1 to 0) passes if bit at pos is 0.
  Parameters:
     n : `int` - The integer to clear a bit from.
     pos : `int` - The zero-based index of the bit to clear.
  Returns: `int` - The result of clearing the specified bit.
 bFlip0s(n) 
  Flips all 0 bits in the number to 1.
  Parameters:
     n : `int` - The integer to flip the bits of.
  Returns: `int` - The result of flipping all 0 bits in the number.
 bFlip1s(n) 
  Flips all 1 bits in the number to 0.
  Parameters:
     n : `int` - The integer to flip the bits of.
  Returns: `int` - The result of flipping all 1 bits in the number.
 bFlipAll(n) 
  Flips all bits in the number.
  Parameters:
     n : `int` - The integer to flip the bits of.
  Returns: `int` - The result of flipping all bits in the number.
 bSet(n, pos, newBit) 
  Changes the value of the bit at the given position.
  Parameters:
     n : `int` - The integer to modify.
     pos : `int` - The position of the bit to change.
     newBit : `int` - na = flips bit at pos reguardless 1 or 0 | The new value of the bit (0 or 1).
  Returns: `int` - The modified integer.
 changeDigit(n, pos, newDigit) 
  Changes the value of the digit at the given position.
  Parameters:
     n : `int` - The integer to modify.
     pos : `int` - The position of the digit to change.
     newDigit : `int` - The new value of the digit (0-9).
  Returns: `int` - The modified integer.
 bSwap(n, i, j) 
  Switch the position of 2 bits of an int
  Parameters:
     n : `int` - int to manipulate
     i : `int` - bit pos to switch with j
     j : `int` - bit pos to switch with i
  Returns: `int` - new int with bits switched
 bPalindrome(n) 
  Checks to see if the binary form is a Palindrome (reads the same left to right and vice versa)
  Parameters:
     n : `int` - int to check
  Returns: `bool` - result of check
 bEven(n) 
  Checks if n is Even
  Parameters:
     n : `int` - The integer to check.
  Returns: `bool` - result.
 bOdd(n) 
  checks if n is Even if not even Odd
  Parameters:
     n : `int` - The integer to check.
  Returns: `bool` - result.
 bPowerOfTwo(n) 
  Checks if n is a Power of 2.
  Parameters:
     n : `int` - number to check.
  Returns: `bool` - result.
 bCount(n, to_count) 
  Counts the number of bits that are equal to 1 in an integer.
  Parameters:
     n : `int` - The integer to count the bits in.
     to_count  `string` -   the bits to count
  Returns: `int` - The number of bits that are equal to 1 in n.
 GCD(a, b) 
  Finds the greatest common divisor (GCD) of two numbers.
  Parameters:
     a : `int` - The first number.
     b : `int` - The second number.
  Returns: `int` - The GCD of a and b.
 LCM(a, b) 
  Finds the least common multiple (LCM) of two integers.
  Parameters:
     a : `int` - The first integer.
     b : `int` - The second integer.
  Returns: `int` - The LCM of a and b.
 aLCM(nums) 
  Finds the LCM of an array of integers.
  Parameters:
     nums : `int ` - The list of integers.
  Returns: `int` - The LCM of the integers in nums.
 adjustedLCM(nums, LCM) 
  adjust an array of integers to Least Common Multiple (LCM)
  Parameters:
     nums : `int ` - The first integer
     LCM : `int` - The second integer
  Returns: `int ` - array of ints with LCM
 charAt(str, pos) 
  gets a Char at a given position.
  Parameters:
     str : `string` - string to pull char from.
     pos : `int` - pos to get char from string (left to right index).
  Returns: `string` - char from pos of string or "" if pos is not within index range
 decimalToBinary(num) 
  Converts a decimal number to binary
  Parameters:
     num : `int` - The decimal number to convert to binary
  Returns: `string` - The binary representation of the decimal number
 decimalToBinary(num, to_binary_int) 
  Converts a decimal number to binary
  Parameters:
     num : `int` - The decimal number to convert to binary
     to_binary_int : `bool` - bool to convert to int or to string (true for int, false for string)
  Returns: `string` - The binary representation of the decimal number
 binaryToDecimal(binary) 
  Converts a binary number to decimal
  Parameters:
     binary : `string` - The binary number to convert to decimal
  Returns: `int` - The decimal representation of the binary number
 decimal_len(n) 
  way of finding decimal length using arithmetic
  Parameters:
     n  `float` - floating decimal point to get length of.
  Returns: `int` - number of decimal places
 int_len(n) 
  way of finding number length using arithmetic
  Parameters:
     n : `int`- value to find length of number
  Returns: `int` - lenth of nunber i.e. 23 == 2
 float_decimal_to_whole(n) 
  Converts a float decimal number to an integer `0.365 to 365`.
  Parameters:
     n : `string` - The decimal number represented as a string.
  Returns: `int` - The integer obtained by removing the decimal point and leading zeroes from s.
 fractional_part(x) 
  Returns the fractional part of a float.
  Parameters:
     x : `float` - The float to get the fractional part of.
  Returns: `float` - The fractional part of the float.
 form_decimal(a, b, zero_fix) 
  helper to form 2 ints into 1 float seperated by the decimal
  Parameters:
     a : `int` - a int
     b : `int` - b int
     zero_fix : `bool` - fix for trailing zeros being truncated when converting to float
  Returns: ` ` - float = float decimal of ints | string = string version of b for future use to ref length
 bEncode(n1, n2) 
  Encodes two numbers into one using bit OR. (fastest)
  Parameters:
     n1 : `int` - The first number to Encodes.
     n2 : `int` - The second number to Encodes.
  Returns: `int` - The result of combining the two numbers using bit OR.
 bDecode(n) 
  Decodes an integer created by the bCombine function.(fastest)
  Parameters:
     n : `int` - The integer to decode.
  Returns: ` ` - A tuple containing the two decoded components of the integer.
 Encode(a, b) 
  Encodes by seperating ints into left and right of decimal float
  Parameters:
     a : `int` - a int
     b : `int` - b int
  Returns: `float` - new float of encoded ints one on left of decimal point one on right
 Decode(encoded) 
  Decodes float of 2 ints seperated by decimal point
  Parameters:
     encoded : `float` - the encoded float value
  Returns: ` ` - tuple of the 2 ints from encoded float
 encode_heavy(a, b) 
  Encodes by combining numbers and tracking size in the
decimal of a floating number (slowest)
  Parameters:
     a : `int` - a int
     b : `int` - b int
  Returns: `float` - new decimal of encoded ints
 decode_heavy(encoded) 
  Decodes encoded float that tracks size of ints in float decimal 
  Parameters:
     encoded : `float` - encoded float
  Returns: ` ` - tuple of decoded ints
 decimal of float (slowest) 
  Parameters:
     encoded : `float` - the encoded float value
  Returns: ` ` - tuple of the 2 ints from encoded float
 Bitwise, Encode, Decode Docs  
 
  In the documentation you may notice the word decimal   
not used as normal this is because when referring to   
binary a decimal number is a number that  
can be represented with base 10 numbers 0-9   
(the wiki below explains better)  
  A rule of thumb for the two integers being   
encoded it to keep both numbers   
less than 65535 this is because anything lower uses 16 bits or less   
this will maintain 100% accuracy when decoding   
although it is possible to do numbers up to 2147483645 with   
this library doesnt seem useful enough  
to explain or demonstrate.  
  The functions provided work within this 32-bit range,   
where the highest number is all 1s and   
the lowest number is all 0s. These functions were created   
to overcome the lack of built-in bitwise functions in Pinescript.   
By combining two integers into a single number,  
the code can access both values i.e when   
indexing only one array index  
for a matrices row/column, thus improving execution time.   
This technique can be applied to various coding   
scenarios to enhance performance.  
  Bitwise functions are a way to use integers in binary form      
that can be used to speed up several different processes      
most languages have operators to perform these function such as      
`<<, >>, &, ^, |, ~` 
 
 en.wikipedia.org  
L_Trade_BoundariesLibrary   "L_Trade_Boundaries" 
Trade Boundaries suggest a strength of the security with respect to previous lows. The "L" implies library, and the trade boundaries implies it could be utilized for price strengths. Though, this should not be used as a single parameter to trade wildly. This library can be imported to a custom indicator to utilized the custom functions. There are moving averages attached at the bottom right of the canvas (overlay) to benchmark the closing price with respect to Moving Averages: 20, 28, and 200 (i.e., "D" if timeframe == "D") respectively. The Volume Indicator located at the top of the canvas is a default function (function already made by the trading view) this shows the volume with respect to the selected time frame. All of the indicators tell a story with regard to the security price (in strength terms).
What is available in this Library?
Litmus Color
> This is a function will change color of two numbers, if the first number is less than the second, the color will be red; otherwise, the color will be green.
Lister
> This is simply using an array by revisiting previous lows and plotting to the current time frame (i.e., "D"). There is a custom frequency input for the function, it will go back as much as the implied/specified length.  Note:    I am still learning how to use array, use this function with discretion.   I would also appreciate if there are suggestions commented below.
Moving Average
> This function invokes three moving average metrics: 20, 28, and 200  respectively. The values are displayed at the bottom right of the canvas. 
Timeframe Highlight
> This function checks for the input timeframe (i.e., "D", "W", "M") and if the time frame happens to be the same, it will give a "true" result. This result can be utilized for highlighting the positive results on the canvas (the red lines).
 litmus_color(value1, value2) 
  Parameters:
     value1 
     value2 
 lister(length) 
  Parameters:
     length 
 moving_averages() 
 timeframe_highlight(timeframe) 
  Parameters:
     timeframe
store - larger data storage for complex item typesLibrary   "store" 
Object/Property Storage System Semi-Simplified. .
It's a helpful toolset while designing UDT's as it remains flexible,
this helps in not having to remap an entire  script while tinkering.
Set an object up, and add as man properties as yyou wish.
a property can be one of any pine built in types. so a single 
object can contain sa, ohlc each with a color, a float, an assigned int
and those 4 props each have 3 sub-assigned values.
as in demo, the alternating table object has 2 different tables
it's a pseudo more complex wa to create our own flexible
version of a UDT, but that will not ~break~ on library updates
so you can update awa without fear, as this libb will no change
saving ou the hassle of creating UDT's that continually change.
 set(dict, _object, _prop, _item) 
  Add/Updates item to storage. Autoselects subclass dictionary on set
  Parameters:
     dict : (dictionary) dict.type subdictionary (req for overload)
     _object : (string)     object name
     _prop 
     _item : ()       item to set
  Returns: item item wwith column/row
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _object, _prop, _item) 
  Parameters:
     dict 
     _object 
     _prop 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 set(dict, _index, _item) 
  Parameters:
     dict 
     _index 
     _item 
 get(typedict, _object, _prop) 
  Get item by object name and property (string)
  Parameters:
     typedict : (dict) dict.type subdictionary (req for overload)
     _object : (string)    object name
     _prop 
  Returns:  item from storage
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 get(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _object, _prop) 
  Remove a specific property from an object
  Parameters:
     typedict : (dict) dict.type subdictionary (req for overload)
     _object : (string)    object name
     _prop 
  Returns:  item from storage
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _object, _prop) 
  Parameters:
     typedict 
     _object 
     _prop 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 remove(typedict, _index) 
  Parameters:
     typedict 
     _index 
 delete(_dict, _object) 
  Remove a complete Object and all props
  Parameters:
     _dict 
     _object : (string)    object name
  Returns:  item from storage
 delete(_dict, _index) 
  Parameters:
     _dict 
     _index 
 wipe(_dict, _object, _prop) 
  Remove Property slot for all 10 item types
  Parameters:
     _dict : (dictionary) The full dictionary item
     _object : (string)    object name
     _prop 
  Returns:  item from storage
 wipe(_dict, _index) 
  Parameters:
     _dict 
     _index 
 init(_Objlim, _Proplim) 
  Create New Dictionary ready to use (9999 size limit - (_objlim +_Proplim) for row/column 0)
# Full dictionary with all types
> start with this
  Parameters:
     _Objlim : (int) maximum objects (think horizontal)
     _Proplim : (int) maximum properties per obj (vertical)
  Returns: dictionary typoe object
 boxdict 
  Fields:
     keys 
     items 
 booldict 
  Fields:
     keys 
     items 
 colordict 
  Fields:
     keys 
     items 
 floatdict 
  Fields:
     keys 
     items 
 intdict 
  Fields:
     keys 
     items 
 labeldict 
  Fields:
     keys 
     items 
 linedict 
  Fields:
     keys 
     items 
 linefilldict 
  Fields:
     keys 
     items 
 stringdict 
  Fields:
     keys 
     items 
 tabledict 
  Fields:
     keys 
     items 
 dictionary 
  Fields:
     boxs 
     bools 
     colors 
     floats 
     ints 
     labels 
     lines 
     linefills 
     strings 
     tables 
     keys 
 item 
  Fields:
     objCol 
     propRow 
     object 
     property 
     actionItem 
 dictionaries 
  Dictionar OF dictionaries
  Fields:
     dicts
arraymethodsLibrary   "arraymethods" 
Supplementary array methods.
 delete(arr, index) 
  remove int object from array of integers at specific index
  Parameters:
     arr : int array
     index : index at which int object need to be removed
  Returns: void
 delete(arr, index) 
  remove float object from array of float at specific index
  Parameters:
     arr : float array
     index : index at which float object need to be removed
  Returns: float
 delete(arr, index) 
  remove bool object from array of bool at specific index
  Parameters:
     arr : bool array
     index : index at which bool object need to be removed
  Returns: bool
 delete(arr, index) 
  remove string object from array of string at specific index
  Parameters:
     arr : string array
     index : index at which string object need to be removed
  Returns: string
 delete(arr, index) 
  remove color object from array of color at specific index
  Parameters:
     arr : color array
     index : index at which color object need to be removed
  Returns: color
 delete(arr, index) 
  remove line object from array of lines at specific index and deletes the line
  Parameters:
     arr : line array
     index : index at which line object need to be removed and deleted
  Returns: void
 delete(arr, index) 
  remove label object from array of labels at specific index and deletes the label
  Parameters:
     arr : label array
     index : index at which label object need to be removed and deleted
  Returns: void
 delete(arr, index) 
  remove box object from array of boxes at specific index and deletes the box
  Parameters:
     arr : box array
     index : index at which box object need to be removed and deleted
  Returns: void
 delete(arr, index) 
  remove table object from array of tables at specific index and deletes the table
  Parameters:
     arr : table array
     index : index at which table object need to be removed and deleted
  Returns: void
 delete(arr, index) 
  remove linefill object from array of linefills at specific index and deletes the linefill
  Parameters:
     arr : linefill array
     index : index at which linefill object need to be removed and deleted
  Returns: void
 popr(arr) 
  remove last int object from array
  Parameters:
     arr : int array
  Returns: int
 popr(arr) 
  remove last float object from array
  Parameters:
     arr : float array
  Returns: float
 popr(arr) 
  remove last bool object from array
  Parameters:
     arr : bool array
  Returns: bool
 popr(arr) 
  remove last string object from array
  Parameters:
     arr : string array
  Returns: string
 popr(arr) 
  remove last color object from array
  Parameters:
     arr : color array
  Returns: color
 popr(arr) 
  remove and delete last line object from array
  Parameters:
     arr : line array
  Returns: void
 popr(arr) 
  remove and delete last label object from array
  Parameters:
     arr : label array
  Returns: void
 popr(arr) 
  remove and delete last box object from array
  Parameters:
     arr : box array
  Returns: void
 popr(arr) 
  remove and delete last table object from array
  Parameters:
     arr : table array
  Returns: void
 popr(arr) 
  remove and delete last linefill object from array
  Parameters:
     arr : linefill array
  Returns: void
 shiftr(arr) 
  remove first int object from array
  Parameters:
     arr : int array
  Returns: int
 shiftr(arr) 
  remove first float object from array
  Parameters:
     arr : float array
  Returns: float
 shiftr(arr) 
  remove first bool object from array
  Parameters:
     arr : bool array
  Returns: bool
 shiftr(arr) 
  remove first string object from array
  Parameters:
     arr : string array
  Returns: string
 shiftr(arr) 
  remove first color object from array
  Parameters:
     arr : color array
  Returns: color
 shiftr(arr) 
  remove and delete first line object from array
  Parameters:
     arr : line array
  Returns: void
 shiftr(arr) 
  remove and delete first label object from array
  Parameters:
     arr : label array
  Returns: void
 shiftr(arr) 
  remove and delete first box object from array
  Parameters:
     arr : box array
  Returns: void
 shiftr(arr) 
  remove and delete first table object from array
  Parameters:
     arr : table array
  Returns: void
 shiftr(arr) 
  remove and delete first linefill object from array
  Parameters:
     arr : linefill array
  Returns: void
 push(arr, val, maxItems) 
  add int to the end of an array with max items cap. Objects are removed from start to maintain max items cap
  Parameters:
     arr : int array
     val : int object to be pushed
     maxItems : max number of items array can hold
  Returns: int 
 push(arr, val, maxItems) 
  add float to the end of an array with max items cap. Objects are removed from start to maintain max items cap
  Parameters:
     arr : float array
     val : float object to be pushed
     maxItems : max number of items array can hold
  Returns: float 
 push(arr, val, maxItems) 
  add bool to the end of an array with max items cap. Objects are removed from start to maintain max items cap
  Parameters:
     arr : bool array
     val : bool object to be pushed
     maxItems : max number of items array can hold
  Returns: bool 
 push(arr, val, maxItems) 
  add string to the end of an array with max items cap. Objects are removed from start to maintain max items cap
  Parameters:
     arr : string array
     val : string object to be pushed
     maxItems : max number of items array can hold
  Returns: string 
 push(arr, val, maxItems) 
  add color to the end of an array with max items cap. Objects are removed from start to maintain max items cap
  Parameters:
     arr : color array
     val : color object to be pushed
     maxItems : max number of items array can hold
  Returns: color 
 push(arr, val, maxItems) 
  add line to the end of an array with max items cap. Objects are removed and deleted from start to maintain max items cap
  Parameters:
     arr : line array
     val : line object to be pushed
     maxItems : max number of items array can hold
  Returns: line 
 push(arr, val, maxItems) 
  add label to the end of an array with max items cap. Objects are removed and deleted from start to maintain max items cap
  Parameters:
     arr : label array
     val : label object to be pushed
     maxItems : max number of items array can hold
  Returns: label 
 push(arr, val, maxItems) 
  add box to the end of an array with max items cap. Objects are removed and deleted from start to maintain max items cap
  Parameters:
     arr : box array
     val : box object to be pushed
     maxItems : max number of items array can hold
  Returns: box 
 push(arr, val, maxItems) 
  add table to the end of an array with max items cap. Objects are removed and deleted from start to maintain max items cap
  Parameters:
     arr : table array
     val : table object to be pushed
     maxItems : max number of items array can hold
  Returns: table 
 push(arr, val, maxItems) 
  add linefill to the end of an array with max items cap. Objects are removed and deleted from start to maintain max items cap
  Parameters:
     arr : linefill array
     val : linefill object to be pushed
     maxItems : max number of items array can hold
  Returns: linefill 
 unshift(arr, val, maxItems) 
  add int to the beginning of an array with max items cap. Objects are removed from end to maintain max items cap
  Parameters:
     arr : int array
     val : int object to be unshift
     maxItems : max number of items array can hold
  Returns: int 
 unshift(arr, val, maxItems) 
  add float to the beginning of an array with max items cap. Objects are removed from end to maintain max items cap
  Parameters:
     arr : float array
     val : float object to be unshift
     maxItems : max number of items array can hold
  Returns: float 
 unshift(arr, val, maxItems) 
  add bool to the beginning of an array with max items cap. Objects are removed from end to maintain max items cap
  Parameters:
     arr : bool array
     val : bool object to be unshift
     maxItems : max number of items array can hold
  Returns: bool 
 unshift(arr, val, maxItems) 
  add string to the beginning of an array with max items cap. Objects are removed from end to maintain max items cap
  Parameters:
     arr : string array
     val : string object to be unshift
     maxItems : max number of items array can hold
  Returns: string 
 unshift(arr, val, maxItems) 
  add color to the beginning of an array with max items cap. Objects are removed from end to maintain max items cap
  Parameters:
     arr : color array
     val : color object to be unshift
     maxItems : max number of items array can hold
  Returns: color 
 unshift(arr, val, maxItems) 
  add line to the beginning of an array with max items cap. Objects are removed and deleted from end to maintain max items cap
  Parameters:
     arr : line array
     val : line object to be unshift
     maxItems : max number of items array can hold
  Returns: line 
 unshift(arr, val, maxItems) 
  add label to the beginning of an array with max items cap. Objects are removed and deleted from end to maintain max items cap
  Parameters:
     arr : label array
     val : label object to be unshift
     maxItems : max number of items array can hold
  Returns: label 
 unshift(arr, val, maxItems) 
  add box to the beginning of an array with max items cap. Objects are removed and deleted from end to maintain max items cap
  Parameters:
     arr : box array
     val : box object to be unshift
     maxItems : max number of items array can hold
  Returns: box 
 unshift(arr, val, maxItems) 
  add table to the beginning of an array with max items cap. Objects are removed and deleted from end to maintain max items cap
  Parameters:
     arr : table array
     val : table object to be unshift
     maxItems : max number of items array can hold
  Returns: table 
 unshift(arr, val, maxItems) 
  add linefill to the beginning of an array with max items cap. Objects are removed and deleted from end to maintain max items cap
  Parameters:
     arr : linefill array
     val : linefill object to be unshift
     maxItems : max number of items array can hold
  Returns: linefill 
 flush(arr) 
  remove all int objects in an array
  Parameters:
     arr : int array
  Returns: int 
 flush(arr) 
  remove all float objects in an array
  Parameters:
     arr : float array
  Returns: float 
 flush(arr) 
  remove all bool objects in an array
  Parameters:
     arr : bool array
  Returns: bool 
 flush(arr) 
  remove all string objects in an array
  Parameters:
     arr : string array
  Returns: string 
 flush(arr) 
  remove all color objects in an array
  Parameters:
     arr : color array
  Returns: color 
 flush(arr) 
  remove and delete all line objects in an array
  Parameters:
     arr : line array
  Returns: line 
 flush(arr) 
  remove and delete all label objects in an array
  Parameters:
     arr : label array
  Returns: label 
 flush(arr) 
  remove and delete all box objects in an array
  Parameters:
     arr : box array
  Returns: box 
 flush(arr) 
  remove and delete all table objects in an array
  Parameters:
     arr : table array
  Returns: table 
 flush(arr) 
  remove and delete all linefill objects in an array
  Parameters:
     arr : linefill array
  Returns: linefill
Vector2FunctionClipLibrary   "Vector2FunctionClip" 
Sutherland-Hodgman polygon clipping algorithm.
reference:
.
rosettacode.org
.
 clip(source, reference) 
  Perform Clip operation on a vector with another.
  Parameters:
     source : array . Source polygon to be clipped.
     reference : array . Reference polygon to clip source.
  Returns: array.
Vector2ArrayLibrary   "Vector2Array" 
functions to handle vector2 Array operations.
.
references:
docs.unity3d.com
gist.github.com
github.com
gist.github.com
gist.github.com
gist.github.com
.
 from(source, prop_sep, vect_sep) 
  Generate array of vector2 from string.
  Parameters:
     source : string Source string of the vectors.
     prop_sep : string Separator character of the vector properties (x`,`y).
     vect_sep : string Separator character of the vectors ((x,y)`;`(x,y)).
  Returns: array.
 max(vectors) 
  Combination of the highest elements in column of a array of vectors.
  Parameters:
     vectors : array, Array of Vector2 objects.
  Returns: Vector2.Vector2, Vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = max(array.from(a, b, c)) , plot(d.x)`
 min(vectors) 
  Combination of the lowest elements in column of a array of vectors.
  Parameters:
     vectors : array, Array of Vector2 objects.
  Returns: Vector2.Vector2, Vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = min(array.from(a, b, c)) , plot(d.x)`
 sum(vectors) 
  Total sum of all vectors.
  Parameters:
     vectors : array, ID of the vector2 array.
  Returns: Vector2.Vector2, vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = sum(array.from(a, b, c)) , plot(d.x)`
 center(vectors) 
  Finds the vector center of the array.
  Parameters:
     vectors : array, ID of the vector2 array.
  Returns: Vector2.Vector2, vector2 object.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = center(array.from(a, b, c)) , plot(d.x)`
 rotate(vectors, center, degree) 
  Rotate Array vectors around origin vector by a angle.
  Parameters:
     vectors : array, ID of the vector2 array.
     center : Vector2.Vector2       , Vector2 object. Center of the rotation.
     degree : float                 , Angle value.
  Returns: rotated points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = rotate(array.from(a, b, c), b, 45.0)`
 scale(vectors, center, rate) 
  Scale Array vectors based on a origin vector perspective.
  Parameters:
     vectors : array, ID of the vector2 array.
     center : Vector2.Vector2       , Vector2 object. Origin center of the transformation.
     rate : float                 , Rate to apply transformation.
  Returns: rotated points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = scale(array.from(a, b, c), b, 1.25)`
 move(vectors, center, rate) 
  Move Array vectors by a rate of the distance to center position (LERP).
  Parameters:
     vectors : array, ID of the vector2 array.
     center 
     rate 
  Returns: Moved points array.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = move(array.from(a, b, c), b, 1.25)`
 to_string(id, separator) 
  Reads a array of vectors into a string, of the form ` `.
  Parameters:
     id : array, ID of the vector2 array.
     separator : string separator for cell splitting.
  Returns: string Translated complex array into string.
-> usage:
`a = Vector2.from(1.0) , b = Vector2.from(2.0), c = Vector2.from(3.0), d = to_string(array.from(a, b, c))`
 to_string(id, format, separator) 
  Reads a array of vectors into a string, of the form ` `.
  Parameters:
     id : array, ID of the vector2 array.
     format : string   , Format to apply transformation.
     separator : string   , Separator for cell splitting.
  Returns: string Translated complex array into string.
-> usage:
`a = Vector2.from(1.234) , b = Vector2.from(2.23), c = Vector2.from(3.1234), d = to_string(array.from(a, b, c), "#.##")`
keyed value types with pseudo-dict - Methods Library   "key_vals" 
a set of primitive single-type key/value items, and pseudo-dictionaries
The dictionaries are single arrays of items, each item has a key and value.
The library is 100% methods. add, remove, get and set items by key. 
It provides methods to get all the keys, values or items in the dict as arrays.
For those familiar with python, it's similar, but typified.. and the brackets are round.
example syntax.. using floats, the same functions exist for Int, Bool and String
 new float_item 
new (‘demo’, 1.0 )
 set the key of a float_item 
float_item.key (‘demo’)
 get the key of a float_item 
float_item.key ()
 set the value of a float_item 
float_item.val (1.5)
 get the value of a float_item 
float_item.val ()
 get the number of items in a dict 
float_dict.count ()
 set an item to a dict by key ( add / update) 
float_dict.set   ( ‘demo’, 2.0 )
 remove an item from a dict by key (changes index, but this is about keys, not ids) 
float_dict.remove   ( ‘demo’ )
 get an item from a dict array 
array.get   (1 )
 get an item from a dict by key 
float_dict.get   ( ‘demo’ )
 get an item from a dict by id (remember, ids change if removed by key) mainlyy an internal function 
float_dict.get   ( 1)
 return all keys as string 
float_dict.get_keys()
 return all values as float 
float_dict.get_values()
 return all items as float 
float_dict.get_items()
 create a new float dict in the multi dict and return the index of it 
multi_dict.add_float_dict()
 get the float dict at index 0 from the multi dict 
multi_dict.get_float_dict( 0)
 set an item in a float dict in a multi dict 
multi_dict.set_float( ‘demo’, 2.0 )
 get an item from a float dict in a multi dict 
multi_dict.get_float( ‘demo’ )
 float_item 
  float_item
  Fields:
     key : (string) 
     val : (float) 
     next : (float_item)
 float_dict 
  float_dict
  Fields:
     content 
 int_item 
  int_item
  Fields:
     key : (string) 
     val : (int) 
     next : (int_item)
 int_dict 
  int_dict
  Fields:
     content 
 string_item 
  string_item
  Fields:
     key : (string) 
     val : (string) 
     next : (string_item)
 string_dict 
  string_dict
  Fields:
     content 
 bool_item 
  bool_item
  Fields:
     key : (string) 
     val : (bool) 
     next : (bool_item)
 bool_dict 
  bool_dict
  Fields:
     content 
 multi_dict 
  multi_dict
  Fields:
     f_dicts 
     f_registry 
     i_dicts 
     i_registry 
     s_dicts 
     s_registry 
     b_dicts 
     b_registry 
 new(key, val) 
  new
  Parameters:
     key : string
     val : float
 new(key, val) 
  Parameters:
     key 
     val 
 new(key, val) 
  Parameters:
     key 
     val 
 new(key, val) 
  Parameters:
     key 
     val 
 key(this, key) 
  key
  Parameters:
     this : float_item
     key : string
 key(this) 
  key
  Parameters:
     this : float_item
 key(this, key) 
  Parameters:
     this 
     key 
 key(this) 
  Parameters:
     this 
 key(this, key) 
  Parameters:
     this 
     key 
 key(this) 
  Parameters:
     this 
 key(this, key) 
  Parameters:
     this 
     key 
 key(this) 
  Parameters:
     this 
 val(this) 
  val
  Parameters:
     this : float_item
 val(this, val) 
  val
  Parameters:
     this : float_item
     val : float
 val(this) 
  Parameters:
     this 
 val(this, val) 
  Parameters:
     this 
     val 
 val(this) 
  Parameters:
     this 
 val(this, val) 
  Parameters:
     this 
     val 
 val(this) 
  Parameters:
     this 
 val(this, val) 
  Parameters:
     this 
     val 
 count(dict) 
  count
  Parameters:
     dict : float_dict
 count(dict) 
  Parameters:
     dict 
 count(dict) 
  Parameters:
     dict 
 count(dict) 
  Parameters:
     dict 
 get(dict, index) 
  get
  Parameters:
     dict : float_dict
     index : int
 get(dict, index) 
  get
  Parameters:
     dict : float_dict
     index : int
 get(d, key) 
  Parameters:
     d 
     key 
 get(dict, index) 
  Parameters:
     dict 
     index 
 get(dict, index) 
  Parameters:
     dict 
     index 
 get(d, key) 
  Parameters:
     d 
     key 
 get(dict, index) 
  Parameters:
     dict 
     index 
 get(dict, index) 
  Parameters:
     dict 
     index 
 get(d, key) 
  Parameters:
     d 
     key 
 get(dict, index) 
  Parameters:
     dict 
     index 
 get(dict, index) 
  Parameters:
     dict 
     index 
 get(d, key) 
  Parameters:
     d 
     key 
 set(d, key, val) 
  set
  Parameters:
     d : float_dict
     key : string
     val : float
 set(d, key, val) 
  Parameters:
     d 
     key 
     val 
 set(d, key, val) 
  Parameters:
     d 
     key 
     val 
 set(d, key, val) 
  Parameters:
     d 
     key 
     val 
 get_keys(d) 
  Parameters:
     d 
 get_keys(d) 
  Parameters:
     d 
 get_keys(d) 
  Parameters:
     d 
 get_keys(d) 
  Parameters:
     d 
 get_values(d) 
  Parameters:
     d 
 get_values(d) 
  Parameters:
     d 
 get_values(d) 
  Parameters:
     d 
 get_values(d) 
  Parameters:
     d 
 get_items(d) 
  Parameters:
     d 
 get_items(d) 
  Parameters:
     d 
 get_items(d) 
  Parameters:
     d 
 get_items(d) 
  Parameters:
     d 
 remove(dict, key) 
  Parameters:
     dict 
     key 
 remove(dict, key) 
  Parameters:
     dict 
     key 
 remove(dict, key) 
  Parameters:
     dict 
     key 
 remove(dict, key) 
  Parameters:
     dict 
     key 
 create_multi_dict() 
 add_float_dict(this) 
  Parameters:
     this 
 add_int_dict(this) 
  Parameters:
     this 
 add_string_dict(this) 
  Parameters:
     this 
 add_bool_dict(this) 
  Parameters:
     this 
 get_float_dict(this, index) 
  Parameters:
     this 
     index 
 get_float_dict(this, key) 
  Parameters:
     this 
     key 
 get_int_dict(this, index) 
  Parameters:
     this 
     index 
 get_int_dict(this, key) 
  Parameters:
     this 
     key 
 get_string_dict(this, index) 
  Parameters:
     this 
     index 
 get_string_dict(this, key) 
  Parameters:
     this 
     key 
 get_bool_dict(this, index) 
  Parameters:
     this 
     index 
 get_bool_dict(this, key) 
  Parameters:
     this 
     key 
 set_float(this, key, val) 
  Parameters:
     this 
     key 
     val 
 set_int(this, key, val) 
  Parameters:
     this 
     key 
     val 
 set_string(this, key, val) 
  Parameters:
     this 
     key 
     val 
 set_bool(this, key, val) 
  Parameters:
     this 
     key 
     val 
PitchforkMethodsLibrary   "PitchforkMethods" 
Methods associated with Pitchfork and Pitchfork Drawing. Depends on the library PitchforkTypes for Pitchfork/PitchforkDrawing objects which in turn use DrawingTypes for basic objects Point/Line/LineProperties. Also depends on DrawingMethods for related methods
 tostring(this) 
  Converts PitchforkTypes/Fork object to string representation
  Parameters:
     this : PitchforkTypes/Fork object
  Returns: string representation of PitchforkTypes/Fork
 tostring(this) 
  Converts Array of PitchforkTypes/Fork object to string representation
  Parameters:
     this : Array of PitchforkTypes/Fork object
  Returns: string representation of PitchforkTypes/Fork array
 tostring(this, sortKeys, sortOrder) 
  Converts PitchforkTypes/PitchforkProperties object to string representation
  Parameters:
     this : PitchforkTypes/PitchforkProperties object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
  Returns: string representation of PitchforkTypes/PitchforkProperties
 tostring(this, sortKeys, sortOrder) 
  Converts PitchforkTypes/PitchforkDrawingProperties object to string representation
  Parameters:
     this : PitchforkTypes/PitchforkDrawingProperties object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
  Returns: string representation of PitchforkTypes/PitchforkDrawingProperties
 tostring(this, sortKeys, sortOrder) 
  Converts PitchforkTypes/Pitchfork object to string representation
  Parameters:
     this : PitchforkTypes/Pitchfork object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
  Returns: string representation of PitchforkTypes/Pitchfork
 createDrawing(this) 
  Creates PitchforkTypes/PitchforkDrawing from PitchforkTypes/Pitchfork object
  Parameters:
     this : PitchforkTypes/Pitchfork object
  Returns: PitchforkTypes/PitchforkDrawing object created
 createDrawing(this) 
  Creates PitchforkTypes/PitchforkDrawing array from PitchforkTypes/Pitchfork array of objects
  Parameters:
     this : array of PitchforkTypes/Pitchfork object
  Returns: array of PitchforkTypes/PitchforkDrawing object created
 draw(this) 
  draws from PitchforkTypes/PitchforkDrawing object
  Parameters:
     this : PitchforkTypes/PitchforkDrawing object
  Returns: PitchforkTypes/PitchforkDrawing object drawn
 delete(this) 
  deletes PitchforkTypes/PitchforkDrawing object
  Parameters:
     this : PitchforkTypes/PitchforkDrawing object
  Returns: PitchforkTypes/PitchforkDrawing object deleted
 delete(this) 
  deletes underlying drawing of PitchforkTypes/Pitchfork object
  Parameters:
     this : PitchforkTypes/Pitchfork object
  Returns: PitchforkTypes/Pitchfork object deleted
 delete(this) 
  deletes array of PitchforkTypes/PitchforkDrawing objects
  Parameters:
     this : Array of PitchforkTypes/PitchforkDrawing object
  Returns: Array of PitchforkTypes/PitchforkDrawing object deleted
 delete(this) 
  deletes underlying drawing in array of PitchforkTypes/Pitchfork objects
  Parameters:
     this : Array of PitchforkTypes/Pitchfork object
  Returns: Array of PitchforkTypes/Pitchfork object deleted
 clear(this) 
  deletes array of PitchforkTypes/PitchforkDrawing objects and clears the array
  Parameters:
     this : Array of PitchforkTypes/PitchforkDrawing object
  Returns: void
 clear(this) 
  deletes array of PitchforkTypes/Pitchfork objects and clears the array
  Parameters:
     this : Array of Pitchfork/Pitchfork object
  Returns: void
PitchforkTypesLibrary   "PitchforkTypes" 
User Defined Types to be used for Pitchfork and Drawing elements of Pitchfork. Depends on DrawingTypes for Point, Line, and LineProperties objects
 PitchforkDrawingProperties 
  Pitchfork Drawing Properties object
  Fields:
     extend : If set to true, forks are extended towards right. Default is true
     fill : Fill forklines with transparent color. Default is true
     fillTransparency : Transparency at which fills are made. Only considered when fill is set. Default is 80
     forceCommonColor : Force use of common color for forks and fills. Default is false
     commonColor : common fill color. Used only if ratio specific fill colors are not available or if forceCommonColor is set to true.
 PitchforkDrawing 
  Pitchfork drawing components
  Fields:
     medianLine : Median line of the pitchfork
     baseLine : Base line of the pitchfork
     forkLines : fork lines of the pitchfork
     linefills : Linefills between forks
 Fork 
  Fork object property
  Fields:
     ratio : Fork ratio
     forkColor : color of fork. Default is blue
     include : flag to include the fork in drawing. Default is true
 PitchforkProperties 
  Pitchfork Properties
  Fields:
     forks : Array of Fork objects
     type : Pitchfork type. Supported values are "regular", "schiff", "mschiff", Default is regular
     inside : Flag to identify if to draw inside fork. If set to true, inside fork will be drawn
 Pitchfork 
  Pitchfork object
  Fields:
     a : Pivot Point A of pitchfork
     b : Pivot Point B of pitchfork
     c : Pivot Point C of pitchfork
     properties : PitchforkProperties object which determines type and composition of pitchfork
     dProperties : Drawing properties for pitchfork
     lProperties : Common line properties for Pitchfork lines
     drawing : PitchforkDrawing object
ZigzagMethodsLibrary   "ZigzagMethods" 
Object oriented implementation of Zigzag methods. Please refer to ZigzagTypes library for User defined types used in this library
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts ZigzagTypes/Pivot object to string representation
  Parameters:
     this : ZigzagTypes/Pivot
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of ZigzagTypes/Pivot
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts Array of Pivot objects to string representation
  Parameters:
     this : Pivot object array
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of Pivot object array
 tostring(this) 
  Converts ZigzagFlags object to string representation
  Parameters:
     this : ZigzagFlags object
  Returns: string representation of ZigzagFlags
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts ZigzagTypes/Zigzag object to string representation
  Parameters:
     this : ZigzagTypes/Zigzagobject
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of ZigzagTypes/Zigzag
 calculate(this, ohlc, indicators, indicatorNames) 
  Calculate zigzag based on input values and indicator values
  Parameters:
     this : Zigzag object
     ohlc : Array containing OHLC values. Can also have custom values for which zigzag to be calculated
     indicators : Array of indicator values
     indicatorNames : Array of indicator names for which values are present. Size of indicators array should be equal to that of indicatorNames
  Returns: current Zigzag object
 calculate(this) 
  Calculate zigzag based on properties embedded within Zigzag object
  Parameters:
     this : Zigzag object
  Returns: current Zigzag object
 nextlevel(this) 
  Calculate Next Level Zigzag based on the current calculated zigzag object
  Parameters:
     this : Zigzag object
  Returns: Next Level Zigzag object
 clear(this) 
  Clears zigzag drawings array
  Parameters:
     this : array
  Returns: void
 drawfresh(this) 
  draws fresh zigzag based on properties embedded in ZigzagDrawing object
  Parameters:
     this : ZigzagDrawing object
  Returns: ZigzagDrawing object
 drawcontinuous(this) 
  draws zigzag based on the zigzagmatrix input
  Parameters:
     this : ZigzagDrawing object
  Returns: 
ZigzagTypesLibrary   "ZigzagTypes" 
Zigzag related user defined types. Depends on DrawingTypes library for basic types
 Indicator 
  Indicator is collection of indicator values applied on high, low and close
  Fields:
     indicatorHigh : Indicator Value applied on High
     indicatorLow : Indicator Value applied on Low
 PivotCandle 
  PivotCandle represents data of the candle which forms either pivot High or pivot low or both
  Fields:
     _high : High price of candle forming the pivot
     _low : Low price of candle forming the pivot
     length : Pivot length
     pHighBar : represents number of bar back the pivot High occurred.
     pLowBar : represents number of bar back the pivot Low occurred.
     pHigh : Pivot High Price
     pLow : Pivot Low Price
     indicators : Array of Indicators - allows to add multiple
 Pivot 
  Pivot refers to zigzag pivot. Each pivot can contain various data
  Fields:
     point : pivot point coordinates
     dir : direction of the pivot. Valid values are 1, -1, 2, -2
     level : is used for multi level zigzags. For single level, it will always be 0
     ratio : Price Ratio based on previous two pivots
     indicatorNames : Names of the indicators applied on zigzag
     indicatorValues : Values of the indicators applied on zigzag
     indicatorRatios : Ratios of the indicators applied on zigzag based on previous 2 pivots
 ZigzagFlags 
  Flags required for drawing zigzag. Only used internally in zigzag calculation. Should not set the values explicitly
  Fields:
     newPivot : true if the calculation resulted in new pivot
     doublePivot : true if the calculation resulted in two pivots on same bar
     updateLastPivot : true if new pivot calculated replaces the old one.
 Zigzag 
  Zigzag object which contains whole zigzag calculation parameters and pivots
  Fields:
     length : Zigzag length. Default value is 5
     numberOfPivots : max number of pivots to hold in the calculation. Default value is 20
     offset : Bar offset to be considered for calculation of zigzag. Default is 0 - which means calculation is done based on the latest bar.
     level : Zigzag calculation level - used in multi level recursive zigzags
     zigzagPivots : array which holds the last n pivots calculated. 
     flags : ZigzagFlags object which is required for continuous drawing of zigzag lines.
 ZigzagObject 
  Zigzag Drawing Object
  Fields:
     zigzagLine : Line joining two pivots
     zigzagLabel : Label which can be used for drawing the values, ratios, directions etc.
 ZigzagProperties 
  Object which holds properties of zigzag drawing. To be used along with ZigzagDrawing
  Fields:
     lineColor : Zigzag line color. Default is color.blue
     lineWidth : Zigzag line width. Default is 1
     lineStyle : Zigzag line style. Default is line.style_solid. 
     showLabel : If set, the drawing will show labels on each pivot. Default is false
     textColor : Text color of the labels. Only applicable if showLabel is set to true.
     maxObjects : Max number of zigzag lines to display. Default is 300
     xloc : Time/Bar reference to be used for zigzag drawing. Default is Time - xloc.bar_time.
 ZigzagDrawing 
  Object which holds complete zigzag drawing objects and properties.
  Fields:
     properties : ZigzagProperties object which is used for setting the display styles of zigzag
     drawings : array which contains lines and labels of zigzag drawing.
     zigzag : Zigzag object which holds the calculations.
DrawingMethodsLibrary   "DrawingMethods" 
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/Point object to string representation
  Parameters:
     this : DrawingTypes/Point object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/Point
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/LineProperties object to string representation
  Parameters:
     this : DrawingTypes/LineProperties object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/LineProperties
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/Line object to string representation
  Parameters:
     this : DrawingTypes/Line object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/Line
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/LabelProperties object to string representation
  Parameters:
     this : DrawingTypes/LabelProperties object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/LabelProperties
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/Label object to string representation
  Parameters:
     this : DrawingTypes/Label object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/Label
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/Linefill object to string representation
  Parameters:
     this : DrawingTypes/Linefill object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/Linefill
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/BoxProperties object to string representation
  Parameters:
     this : DrawingTypes/BoxProperties object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/BoxProperties
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/BoxText object to string representation
  Parameters:
     this : DrawingTypes/BoxText object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/BoxText
 tostring(this, sortKeys, sortOrder, includeKeys) 
  Converts DrawingTypes/Box object to string representation
  Parameters:
     this : DrawingTypes/Box object
     sortKeys : If set to true, string output is sorted by keys.
     sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
     includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of DrawingTypes/Box
 delete(this) 
  Deletes line from DrawingTypes/Line object
  Parameters:
     this : DrawingTypes/Line object
  Returns: Line object deleted
 delete(this) 
  Deletes label from DrawingTypes/Label object
  Parameters:
     this : DrawingTypes/Label object
  Returns: Label object deleted
 delete(this) 
  Deletes Linefill from DrawingTypes/Linefill object
  Parameters:
     this : DrawingTypes/Linefill object
  Returns: Linefill object deleted
 delete(this) 
  Deletes box from DrawingTypes/Box object
  Parameters:
     this : DrawingTypes/Box object
  Returns: DrawingTypes/Box object deleted
 delete(this) 
  Deletes lines from array of DrawingTypes/Line objects
  Parameters:
     this : Array of DrawingTypes/Line objects
  Returns: Array of DrawingTypes/Line objects
 delete(this) 
  Deletes labels from array of DrawingTypes/Label objects
  Parameters:
     this : Array of DrawingTypes/Label objects
  Returns: Array of DrawingTypes/Label objects
 delete(this) 
  Deletes linefill from array of DrawingTypes/Linefill objects
  Parameters:
     this : Array of DrawingTypes/Linefill objects
  Returns: Array of DrawingTypes/Linefill objects
 delete(this) 
  Deletes boxes from array of DrawingTypes/Box objects
  Parameters:
     this : Array of DrawingTypes/Box objects
  Returns: Array of DrawingTypes/Box objects
 clear(this) 
  clear items from array of DrawingTypes/Line while deleting underlying objects
  Parameters:
     this : array
  Returns: void
 clear(this) 
  clear items from array of DrawingTypes/Label while deleting underlying objects
  Parameters:
     this : array
  Returns: void
 clear(this) 
  clear items from array of DrawingTypes/Linefill while deleting underlying objects
  Parameters:
     this : array
  Returns: void
 clear(this) 
  clear items from array of DrawingTypes/Box while deleting underlying objects
  Parameters:
     this : array
  Returns: void
 draw(this) 
  Creates line from DrawingTypes/Line object
  Parameters:
     this : DrawingTypes/Line object
  Returns: line created from DrawingTypes/Line object
 draw(this) 
  Creates lines from array of DrawingTypes/Line objects
  Parameters:
     this : Array of DrawingTypes/Line objects
  Returns: Array of DrawingTypes/Line objects
 draw(this) 
  Creates label from DrawingTypes/Label object
  Parameters:
     this : DrawingTypes/Label object
  Returns: label created from DrawingTypes/Label object
 draw(this) 
  Creates labels from array of DrawingTypes/Label objects
  Parameters:
     this : Array of DrawingTypes/Label objects
  Returns: Array of DrawingTypes/Label objects
 draw(this) 
  Creates linefill object from DrawingTypes/Linefill
  Parameters:
     this : DrawingTypes/Linefill objects
  Returns: linefill object created
 draw(this) 
  Creates linefill objects from array of DrawingTypes/Linefill objects
  Parameters:
     this : Array of DrawingTypes/Linefill objects
  Returns: Array of DrawingTypes/Linefill used for creating linefills
 draw(this) 
  Creates box from DrawingTypes/Box object
  Parameters:
     this : DrawingTypes/Box object
  Returns: box created from DrawingTypes/Box object
 draw(this) 
  Creates labels from array of DrawingTypes/Label objects
  Parameters:
     this : Array of DrawingTypes/Label objects
  Returns: Array of DrawingTypes/Label objects
 createLabel(this, lblText, tooltip, properties) 
  Creates DrawingTypes/Label object from DrawingTypes/Point
  Parameters:
     this : DrawingTypes/Point object
     lblText : Label text
     tooltip : Tooltip text. Default is na
     properties : DrawingTypes/LabelProperties object. Default is na - meaning default values are used.
  Returns: DrawingTypes/Label object
 createLine(this, other, properties) 
  Creates DrawingTypes/Line object from one DrawingTypes/Point to other
  Parameters:
     this : First DrawingTypes/Point object
     other : Second DrawingTypes/Point object
     properties : DrawingTypes/LineProperties object. Default set to na - meaning default values are used.
  Returns: DrawingTypes/Line object
 createLinefill(this, other, fillColor, transparency) 
  Creates DrawingTypes/Linefill object from DrawingTypes/Line object to other DrawingTypes/Line object
  Parameters:
     this : First DrawingTypes/Line object
     other : Other DrawingTypes/Line object
     fillColor : fill color of linefill. Default is color.blue
     transparency : fill transparency for linefill. Default is 80
  Returns: Array of DrawingTypes/Linefill object
 createBox(this, other, properties, textProperties) 
  Creates DrawingTypes/Box object from one DrawingTypes/Point to other
  Parameters:
     this : First DrawingTypes/Point object
     other : Second DrawingTypes/Point object
     properties : DrawingTypes/BoxProperties object. Default set to na - meaning default values are used.
     textProperties : DrawingTypes/BoxText object. Default is na - meaning no text will be drawn
  Returns: DrawingTypes/Box object
 createBox(this, properties, textProperties) 
  Creates DrawingTypes/Box object from DrawingTypes/Line as diagonal line
  Parameters:
     this : Diagonal DrawingTypes/PoLineint object
     properties : DrawingTypes/BoxProperties object. Default set to na - meaning default values are used.
     textProperties : DrawingTypes/BoxText object. Default is na - meaning no text will be drawn
  Returns: DrawingTypes/Box object
DrawingTypesLibrary   "DrawingTypes" 
User Defined Types for basic drawing structure. Other types and methods will be built on these.
 Point 
  Point refers to point on chart
  Fields:
     price : pivot price
     bar : pivot bar
     bartime : pivot bar time
 LineProperties 
  Properties of line object
  Fields:
     xloc : X Reference - can be either xloc.bar_index or xloc.bar_time. Default is xloc.bar_index
     extend : Property which sets line to extend towards either right or left or both. Valid values are extend.right, extend.left, extend.both, extend.none. Default is extend.none
     color : Line color
     style : Line style, valid values are line.style_solid, line.style_dashed, line.style_dotted, line.style_arrow_left, line.style_arrow_right, line.style_arrow_both. Default is line.style_solid
     width : Line width. Default is 1
 Line 
  Line object created from points
  Fields:
     start : Starting point of the line
     end : Ending point of the line
     properties : LineProperties object which defines the style of line
     object : Derived line object
 LabelProperties 
  Properties of label object
  Fields:
     xloc : X Reference - can be either xloc.bar_index or xloc.bar_time. Default is xloc.bar_index
     yloc : Y reference - can be yloc.price, yloc.abovebar, yloc.belowbar. Default is yloc.price
     color : Label fill color
     style : Label style as defined in www.tradingview.com Default is label.style_none
     textcolor : text color. Default is color.black
     size : Label text size. Default is size.normal. Other values are size.auto, size.tiny, size.small, size.normal, size.large, size.huge
     textalign : Label text alignment. Default if text.align_center. Other allowed values - text.align_right, text.align_left, text.align_top, text.align_bottom
     text_font_family : The font family of the text. Default value is font.family_default. Other available option is font.family_monospace
 Label 
  Label object
  Fields:
     point : Point where label is drawn
     lblText : label text
     tooltip : Tooltip text. Default is na
     properties : LabelProperties object
     object : Pine label object
 Linefill 
  Linefill object
  Fields:
     line1 : First line to create linefill
     line2 : Second line to create linefill
     fillColor : Fill color
     transparency : Fill transparency range from 0 to 100
     object : linefill object created from wrapper
 BoxProperties 
  BoxProperties object
  Fields:
     border_color : Box border color. Default is color.blue
     bgcolor : box background color
     border_width : Box border width. Default is 1
     border_style : Box border style. Default is line.style_solid
     extend : Extend property of box. default is extend.none
     xloc : defines if drawing needs to be done based on bar index or time. default is xloc.bar_index
 BoxText 
  Box Text properties.
  Fields:
     boxText : Text to be printed on the box
     text_size : Text size. Default is size.auto
     text_color : Box text color. Default is color.yellow. 
     text_halign : horizontal align style - default is text.align_center
     text_valign : vertical align style - default is text.align_center
     text_wrap : text wrap style - default is text.wrap_auto
     text_font_family : Text font. Default is
 Box 
  Box object
  Fields:
     p1 : Diagonal point one
     p2 : Diagonal point two
     properties : Box properties
     textProperties : Box text properties
     object : Box object created
UtilitiesLibrary   "Utilities" 
My utility functions library.
 toPips(_v) 
  Convert price to pips.
  Parameters:
     _v : Price
  Returns: Pips
 toPrice(_p) 
  Convert pips to price.
  Parameters:
     _p 
  Returns: Price
 price_range(_a, _b) 
  The difference will be returned.
  Parameters:
     _a 
     _b : @return Price as positive number
 get_day(_n, _lang) 
  Get the day of the week
  Parameters:
     _n : Number of day of week
     _lang : en or ja
 source(_name) 
  TODO: add function description here
  Parameters:
     _name 
  Returns: TODO: add what function returns
 clear_lines(_arr, _min) 
  Deletes the lines included in the array.
  Parameters:
     _arr : Array of lines
     _min : Deletes the lines included in the array.
 clear_labels(_arr, _min) 
  Deletes the labels included in the array.
  Parameters:
     _arr : Array of labels
     _min : Deletes the labels included in the array.
 clear_boxes(_arr, _min) 
  Deletes the boxes included in the array.
  Parameters:
     _arr : Array of boxes
     _min : Deletes the boxes included in the array.
eHarmonicpatternsLogScaleLibrary   "eHarmonicpatternsLogScale" 
Library provides functions to scan harmonic patterns both or normal and log scale
 getSupportedPatterns() 
 get_prz_range(x, a, b, c, patternArray, errorPercent, start_adj, end_adj, logScale) 
  Provides PRZ range based on BCD and XAD ranges
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     patternArray : Pattern flags for which PRZ range needs to be calculated
     errorPercent : Error threshold
     start_adj : - Adjustments for entry levels
     end_adj : - Adjustments for stop levels
     logScale : - calculate on log scale. Default is false
  Returns:   Start and end of consolidated PRZ range
 get_prz_range_xad(x, a, b, c, patternArray, errorPercent, start_adj, end_adj, logScale) 
  Provides PRZ range based on XAD range only
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     patternArray : Pattern flags for which PRZ range needs to be calculated
     errorPercent : Error threshold
     start_adj : - Adjustments for entry levels
     end_adj : - Adjustments for stop levels
     logScale : - calculate on log scale. Default is false
  Returns:   Start and end of consolidated PRZ range
 get_projection_range(x, a, b, c, patternArray, errorPercent, start_adj, end_adj, logScale) 
  Provides Projection range based on BCD and XAD ranges
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     patternArray : Pattern flags for which PRZ range needs to be calculated
     errorPercent : Error threshold
     start_adj : - Adjustments for entry levels
     end_adj : - Adjustments for stop levels
     logScale : - calculate on log scale. Default is false
  Returns:   Array containing start and end ranges
 isHarmonicPattern(x, a, b, c, d, flags, defaultEnabled, errorPercent, logScale) 
  Checks for harmonic patterns
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     d : D coordinate value
     flags : flags to check patterns. Send empty array to enable all 
     defaultEnabled 
     errorPercent : Error threshold
     logScale : - calculate on log scale. Default is false
  Returns:   Array of boolean values which says whether valid pattern exist and array of corresponding pattern names
 isHarmonicProjection(x, a, b, c, flags, defaultEnabled, errorPercent, logScale) 
  Checks for harmonic pattern projection
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     flags : flags to check patterns. Send empty array to enable all 
     defaultEnabled 
     errorPercent : Error threshold
     logScale : - calculate on log scale. Default is false
  Returns:   Array of boolean values which says whether valid pattern exist and array of corresponding pattern names.
MyLibraryLibrary   "MyLibrary" 
TODO: add library description here
 init(value) 
  Parameters:
     value 
 set(source, value) 
  Parameters:
     source 
     value 
 get(source) 
  Parameters:
     source
Replica of TradingView's Backtesting Engine with ArraysHello everyone,
Here is a perfectly replicated TradingView backtesting engine condensed into a single library function calculated with arrays. It includes TradingView's calculations for Net profit, Total Trades, Percent of Trades Profitable, Profit Factor, Max Drawdown (absolute and percent), and Average Trade (absolute and percent). Here's how TradingView defines each aspect of its backtesting system:
Net Profit: The overall profit or loss achieved.
Total Trades: The total number of closed trades, winning and losing.
Percent Profitable: The percentage of winning trades, the number of winning trades divided by the total number of closed trades.
Profit Factor: The amount of money the strategy made for every unit of money it lost, gross profits divided by gross losses.
Max Drawdown: The greatest loss drawdown, i.e., the greatest possible loss the strategy had compared to its highest profits.
Average Trade: The sum of money gained or lost by the average trade, Net Profit divided by the overall number of closed trades.
Here's how each variable is defined in the library function: 
_backtest(bool _enter, bool _exit, float _startQty, float _tradeQty)
 
  bool _enter: When the strategy should enter a trade (entry condition)
  bool _exit: When the strategy should exit a trade (exit condition)
  float _startQty: The starting capital in the account (for BTCUSD, it is the amount of USD the account starts with)
  float _tradeQty: The amount of capital traded (if set to 1000 on BTCUSD, it will trade 1000 USD on each trade)
 
Currently, this library only works with long strategies, and I've included a commented out section under DEMO STRATEGY where you can replicate my results with TradingView's backtesting engine. There's tons I could do with this beyond what is shown, but this was a project I worked on back in June of 2022 before getting burned out. Feel free to comment with any suggestions or bugs, and I'll try to add or fix them all soon. Here's my list of thing to add to the library currently (may not all be added):
 
  Add commission calculations.
  Add support for shorting
  Add a graph that resembles TradingView's overview graph.
  Clean and optimize code.
  Clean up in a way that makes it easy to add other TradingView calculations (such as Sharpe and Sortino ratio).
  Separate all variables, so they become accessible outside of calculations (such as gross profit, gross loss, number of winning trades, number of losing trades, etc.).
 
Thanks for reading,
OztheWoz






















