CSVParser█ OVERVIEW
The library contains functions for parsing and importing complex CSV configurations (with a special simple syntax) into a special hierarchical object (of type objProps ) as follows:
Functions:
parseConfig() - reads CSV text into an objProps object.
toT() - displays the contents of an objProps object in a table form, which allows to check the CSV text for syntax errors.
getPropAr() - returns objProps.arS array for child object with `prop` key in mpObj map (or na if not found)
This library is handy in allowing users to store presets for the scripts and switch between them (see, e.g., my HTF moving averages script where users can switch between several preset configuations of 24 MA's across 5 timeframes).
█ HOW THE SCRIPT WORKS.
The script works as follows:
all values read from config text are stored as strings
Nested brackets in config text create a named nested objects of objProps0, ... , objProps9 types.
objProps objects of each level have the following fields:
- array arS for storing values without names (e.g. "12, 23" will be imported into a string array arS as )
- map mpS for storing items with names (e.g. "tf = 60, length = 21" will be imported as <"tf", "60"> and <"length", "21"> pairs into mpS )
- map mpObj for storing nested objects (e.g. "TF1(tf=60, length(21,50,100))" creates a <"TF1, objProps0 object> pair in mpObj map property of the top level object (objProps) , "tf=60" is stored as <"tf", "60"> key-value pair in mpS map property of a next level object (objProps0) and "length (...)" creates a <"length", objProps1> pair in objProps0.mpObj map while length values are stored in objProps1.arS array as strings. Every opening bracket creates a next level objProps object.
If objects or properties with duplicate names are encountered only the latest is imported
(e.g. for "TF1(length(12,22)), TF1(tf=240)" only "TF1(tf=240)" will be imported
Line breaks are not regarded as part of syntax (i.e. values are imported with line breaks, you can supply
symbols "(" , ")" , "," and "=" are special characters and cannot be used within property values (with the exception of a quoted text as a value of a property as explained below)
named properties can have quoted text as their value. In that case special characters within quotation marks are regarded as normal characters. Text between "=" and opening quotation mark as well as text following the closing quotation mark and until next property value is ignored. E.g. "quote = ignored "The quote" also ignored" will be imported as <"quote", "The quote">. Quotation marks within quotes must be excaped with "\" .
if a key names happens to be a multi-line then only first line containing non-space characters (trimmed from spaces) is taken as a key.
")," or ") ," and similar do not create an empty ("") array item while ",," does. (",)" creates an "" array item)
█ CSV CONFIGURATION SYNTAX
Unnamed values: just list them comma separated and they will be imported into arS of the object of the current level.
Named values: use "=" sign as follows: "property1=value1, property2 = value2"
Value of several objects: Use brackets after the name of the object ant list all object properties within the brackets (including its child objects if necessary). E.g. "TF1(tf =60, length(21,200), TF2(tf=240, length(50,200)"
Named and unnamed values as well as objects can go in any order. E.g. "12, tf=60, 21" will be imported as follows: "12", "21" will go to arS array and <"tf", "60"> will go to mpS maP of objProps (the top level object).
You can play around and test your config text using demo in this library, just edit your text in script settings and see how it is parsed into objProps objects.
█ USAGE RECOMMENDATIONS AND SAMPLE USE
I suggest the following approach:
- create functions for your UDT which can set properties by name.
- create enumerator functions which iterates through all the property names (supplied as a const string array) and imports their values into the object
█ SAMPLE USE
A sample use of this library can be seen in my Multi-timeframe 24 moving averages + BB+SAR+Supertrend+VWAP script where settings for the MAs across many timeframes are imported from CSV configurations (presets).
█ FULL LIST OF FUNCTIONS AND PROPERTIES
nzs(_s, nz)
Like nz() but for strings. Returns `nz` arg (default = "") if _s is na.
Parameters:
_s (string)
nz (string)
method init(this)
Initializes objProps obj (creates child maps and arrays)
Namespace types: objProps
Parameters:
this (objProps)
method toT(this, nz)
Outputs objProps to string matrices for further display using autotable().
Namespace types: objProps, objProps1, ..., objProps9
Parameters:
this (objProps/objProps1/..../objProps9)
nz (string)
Returns: A tuple - value, merge and color matrix (autotable() parameters)
method parseConfig(this, s)
Reads config text into objProps (unnamed values into arS, named into mpS, sub-levels into mpObj)
Namespace types: objProps
Parameters:
this (objProps)
s (string)
method getPropArS(this, prop)
Returns a string array of values for a given property name `prop`. Looks for a key `prop` in objProps.mpObj
if finds pair returns obj.arS, otherwise returns na. Returns a reference to the original, not a copy.
Namespace types: objProps, objProps1, ..., objProps8
Parameters:
this (objProps/objProps1/..../objProps8)
prop (string)
method getPropVal(this, prop, id)
Checks if there is an array of values for property `prop` and returns its `id`'s element or na if not found
Namespace types: objProps, objProps1, ..., objProps8
Parameters:
this (objProps/objProps1/..../objProps8) : objProps object containing array of property values in a child objProp object corresponding to propertty name.
prop (string) : (string) Name of the property
id (int) : (int) Id of the element to be returned from the array pf property values
objProps9 type
Object for storing values read from CSV relating to a particular object or property name.
Fields:
mpS (map) : (map() Stores property values as pairs
arS (array) : (string ) Array of values
objProps, objProps0, ... objProps8 types
Object for storing values read from CSV relating to a particular object or property name.
Fields:
mpS (map) : (map() Stores property values as pairs
arS (array) : (string ) Array of values
mpObj (map) : (map() Stores objProps objects containing properties's data as pairs
String
StrTrimPadCase█ OVERVIEW
Contains various functions for manipulation with strings:
- padright() / padleft() - Pad a string to the right or left with a given char.
- trim2() - Trims not only spaces but also line breaks.
- nz(string) - like nz(), replaces na with a supplied string
█ FUNCTIONS
nz(s, replacement)
Similar to nz() but for strings. However, since `string(na)` is the same as `""`
there is no such thing as `na` for strings. So, the function just replaces `""` with `replacement`.
Parameters:
s (string)
replacement (string) : (string) (Optional) A string returned when `s` is `""` / `na`. Default: `""`
method toUppercase(s)
Converts a string to uppercase
Namespace types: series string, simple string, input string, const string
Parameters:
s (string)
method toLowercase(s)
Converts a string to uppercase
Namespace types: series string, simple string, input string, const string
Parameters:
s (string)
method padright(this, length, char)
pads a string up to `length` by adding `char`'s (spaces by default) to the end. (the first char of `char`
string is used). Respects max string length of 4096.
Namespace types: series string, simple string, input string, const string
Parameters:
this (string)
length (int)
char (simple string) : (string) A char to pad with. (if string longer than one char is supplied uses the first char)
method padleft(this, length, char)
pads a string up to `length` by adding `char`'s (spaces by default) to the beginning(the first char of
`char` string is used). Respects max string length of 4096.
Namespace types: series string, simple string, input string, const string
Parameters:
this (string)
length (int)
char (simple string) : (string) A char to pad with. (if string longer than one char is supplied uses the first char)
StrConcatWrap█ OVERVIEW
Contains functions for concatenation and wrapping of the strings:
- concatTrunc() / concatTrunc2() - Concatenate via a separator up to a given length truncating from left or right. concatTrunc2 returns also the number of overflowing chars (in a tuple)
- print() - A powerful concatenate function truncating chars from left or right and/or lines from top or bottom. By default just adds new lines respecting max length.
- wrap() - Wraps each line of the text adding prefix/postfix. If resulting string exceeds max length truncates from the end adding " "
- scroll() Returns a range of lines from the source string.
█ FUNCTIONS
method concatTrunc2(this, txt, separator, max_length, truncate_left, ignore_empty_strings)
Concatenates two strings leaving _max_length chars truncating from left/right. (Truncates from the end of the string by default).
this String to which txt is added
txt String to be added
max_length (int) (Optional) max length of string, default: 4096
separator (string) (Optional) If both this and txt are non empty separator is added in between. Usually " " is used.
truncate_left (bool) (Optional) if true truncates left string (this), if false - txt. Default - false (truncates txt)
ignore_empty_strings (bool) (Optional) if true and one of `this` or `txt` is empty just returns the other, if false - adds separator.
Returns: (tuple ) A tuple . E.g. if `this` is 4095 chars and separator is 2 chars then 4095+2=4097 exceeds default max_length = 4096 by 1, so will be returned, even if , e.g. `txt` is empty and `ignore_empty_strings` is true.
method concatTrunc(this, txt, separator, max_length, truncate_left, ignore_empty_strings)
Concatenates two strings leaving _max_length chars truncating from left/right. (Truncates from the end of the string by default).
this : string to which txt is added
txt : string to be added to this
max_length : max length of string, default: 4096
separator : If both this and txt are non empty separator is added in between. Usually " " is used.
truncate_left : if true truncates left string (this), if false - txt. Default - false (truncates txt)
ignore_empty_strings : (bool) (Optional) if true and one of `this` or `txt` is empty just returns the other, if false - adds separator.
Returns: (string) Resulting string
method printLines( this, txt, max_length, max_lines, line_break_regex, line_break, truncate_left, ignore_empty_strings, add_line_numbers, line_number_format, start_line_number, print_to_last_line)
Adds up to `max_lines` lines from `txt` to `this` observing `max_length`, truncating from left or right (truncating source strings `this` and/or `txt` themselves if necessary).
this : (string) Print outputs `txt` to the end of `this`
txt : (string) Print outputs `txt` to the end of `this`
max_length : (int) (Optional) Chars in excess of `max_length` will be truncated (ending chars by default, see `truncate_left` arg). Default: 4096
max_lines : (int) (Optional) Lines in excess of `max_lines` will be truncated (from end by default, see `truncate_left` arg). Default: 4096
line_break_regex : (string) (Optional) A regex expression used to search for linebrakes. Default is "( |\\r|\\r )"
line_break : (string) (Optional) A string added as a line break. Default is " ".
truncate_left : (bool) (Optional) If true chars in excess of `max_length` will be truncated from the beginning , if false - from the end. Default: false.
ignore_empty_strings : (bool) (Optional) If false a line break will be added (as an empty string), if false `this` will not change.
add_line_numbers : (bool) (Optional) If true adds number before each line. Default format: "LN0001". Custom fomat can be set with `line_number_format'.
line_numbers_format : (string) (Optional) Line number format (like in `str.format()`). Default: `"LN{0000: }"`
print_to_last_line : (string) (Optional) If true will add text to the last line (notwithout adding line break before the first added line). Default: false.
Returns: ` ` where `outS` = `this` + added lines, `intLenthOverflow` = number of truncated chars (including separator), e.g. if `this` is 4095 chars and separator is 2 chars then 4095+2=4097 exceeds default max_length = 4096 by 1, so will be returned, even if , e.g. `txt` is empty and `ignore_empty_strings` is true, and n - number of added lines
method print( this, txt, max_length, max_lines, truncate_left, truncate_top, truncate_lines_src, add_line_numbers, line_number_format, print_to_last_line)
Powerful concatenate function. In simplest form (`this.print(txt)`) just adds `txt` to the end of `this` starting from new line. If `print_to_last_line` is true then concatenates. Can truncate for _max_length (from right by default) and max_lines (truncating from top or bottom). (First removes excessive lines (over `max_lines`) then concatenates truncating for `max_length`.) `print()` looks for all kinds of line breaks (`\r`, ` ` or `\r `) and replaces them with ` `.
this : (string) Print outputs `txt` to the end of `this`
txt : (string) Print outputs `txt` to the end of `this`
max_length : (int) (Optional) Chars in excess of `max_length` will be truncated (ending chars by default, see `truncate_left` arg). Default: 4096
max_lines : (int) (Optional) Lines in excess of `max_lines` will be truncated (from end by default, see `truncate_left` arg). Default: 4096
truncate_left : (bool) (Optional) If true chars in excess of `max_length` will be truncated from the beginning , if false - from the end. Default: false.
truncate_top : (bool) (Optional) If true lines in excess of `max_lines` will be truncated from the top, if false - from the bottom. Default: false.
truncate_lines_src : (bool) (Optional) If true and either `this` or `txt` exceed `max_lines` they will be truncated (excessive lines removed). (Characters in excess of max_length will be truncated regardless). If truncate_top and txt has more than max_lines lines excessive lines will be truncated from the top. (if truncate_top escessive lines from `this` will be truncated regardless of truncate_src). If not truncate_top and this has more than max_lines lines excessive lines will be truncated from the bottom. (if not truncate_top escessive lines from `txt` will be truncated regardless of truncate_src)
add_line_numbers : (bool) (Optional) If true adds number before each line. Default format: "LN0001". Custom fomat can be set with `line_number_format'.
line_numbers_format : (string) (Optional) Line number format (like in `str.format()`). Default: `"LN{0000: }"`
print_to_last_line : (string) (Optional) If true will add text to the last line (notwithout adding line break before the first added line). Default: false.
Returns: ` ` where `outS` = `this` + added lines.
method wrap(this, wrap_width, breaker_prefix, breaker_postfix, line_postfix, max_length)
Wraps each line of `this` to wrap_width adding breaker_prefix to the end of each line (before " ") and breaker_postfix to the beginning of each line (after " ")" (i.e. breaker_prefix'es are effectively added to the end of each line (but the last) and breaker_postfix'es to the beginning of new line starting from second). If with breakers the line exceeds 4096 it is truncated from the right and " " is added at the end.
wrap_width : (series int) Width of each line (chars).
breaker_prefix : (series string) (Optional) Text to add at the end of each line. (Default = "")
breaker_postfix : (series string) (Optional) Text to add after the each added line break at the beginning of next line. (Default = "")
Returns: the wrapped text
export method scroll(this, start_line, lines_in_window, show_line_numbers, show_header)
Scrolls the text (this) by returning a given number of lines (`lines_in_window`) starting from `start_line`. Can add line numbers and/or a header line in the form "Starting from line ... out of total ... lines, ... chars"
start_line : (int) (Optional) Start line
lines_in_window : (int) (Optional) Number of lines to read and return
show_line_numbers : (bool) (Optional) If true preceeds each line with a line number in the form "LN0001}: "
show_header : (bool) (Optional) If true shows the header string in the form "Starting from line {0} out of total {1} lines, {2} chars" followed by a separator line "----------".
Returns: (string) Range of strings.
RegexLib█ OVERVIEW
This library contains regular expression (regex) search functions which are helpful, in particular, in reading configuration inputs.
feedRgx(): Searches for the first occurrence of `regex` pattern in the `src` and returns `src` split into parts as a tuple: ` `. If no match returns ` `
countRgx(): Counts `regex` occurrences in the `src`.
matchRgx(): Finds given `occurence` of `regex` pattern in `src` string.
NB! countRgx() and matchRgx() do not support `^` (beginning of the string placeholder), lookbehind some other complex patterns, because they works by cutting off the part of the string up to the first found occurence (inclusive) and then continuing the search on the remainder of the string. E.g. in a four line source `(?<= ).+ ` should match the second and the third lines but matchRgx only matches the second line since after matching it continues to search in the remainder AFTER the match only.
█ FULL LIST OF FUNCTIONS AND PARAMETERS
method feedRgx(src, regex)
Searches for the first occurrence of ` regex ` pattern in the ` src ` and returns ` src ` split into parts as a tuple: ` `. If no match returns ` `
Namespace types: series string, simple string, input string, const string
Parameters:
src (string) : (string) String to search for the regex pattern
regex (string) : (string) RegEx pattern
Returns: A tuple ` ` where `begS` is the part of the `src` string from the beginning up to the
first occurence of the `regex` pattern (or up to the end if not found), `matchS` - the first occurrence of the
regex pattern and `endS` the part of the strinf following the first occurrence of the `regex` pattern.
method countRgx(src, regex)
Counts `regex` occurrences in the `src`. ___NB!___ _Does not support `^` (beginning of the string
placeholder), lookbehind some other complex patterns, because it works by cutting off the part of the string up to
the first found occurence (inclusive) and then continuing the search on the remainder of the string. E.g. in a four line source `(?<= ).+ ` should match the second and the third lines but matchRgx only
matches the second line since after matching it continues to search in the remainder AFTER the match only. _
Namespace types: series string, simple string, input string, const string
Parameters:
src (string) : (string) String in which the regex pattern occurences are to be counted
regex (string) : (string) RegEx pattern
Returns: The number of occurrences of the `regex` pattern in the `src` string.
method matchRgx(src, regex, occurrence)
Finds given `occurence` of `regex` pattern in `src` string. ___NB!___ _Does not support `^` (beginning of the string placeholder), lookbehind and some other complex patterns, because it works by cutting off the part of the string up to the first found occurence (inclusive) and then continuing the search on the remainder of the string. E.g. in a four line source `(?<= ).+ ` should match the second and the third lines but matchRgx only matches the second line since after matching it continues to search in the remainder AFTER the match only. _
Namespace types: series string, simple string, input string, const string
Parameters:
src (string) : (string) String to search for the regex pattern
regex (string) : (string) RegEx pattern
occurrence (int) : (int) (Default is 1) The number of the occurrence to search for. If this params exceeds the actual
number of occurrences of the pattern in the `src` string the following tuple is returned
Returns: A tuple, matchS - matched substring, matchPos - position of the match, matchL - match length
█ HOW TO USE
See DEMO section in the script.
You can test regex patterns by playing around with script input settings.
Another usage example can be found in my CSVParser and HTFMAs libraries.
ToStringMx█ OVERVIEW
Contains methods for conversion of matrices to string.
Supports matrices of int/float/bool/string/color/line/label/box/.
- toStringMx(matrix) - converts matrix to a string matrix converting each of its elements to string
- toS(matrix) - converts matrix to a string matrix (using toStringMx()) and outputs as string using str.tostring(matrix)
Conversion of each item to string is made using toS() function from moebius1977/ToS/1 library.
█ GENERAL DESCRIPTION OF FUNCTIONS
All toStringMx(matrix) and toS(matrix) methods have same parameters. The only difference will be in format parameter as explained below.
Parameters:
this (matrix) Matrix to be converted to a string matrix.
format (string) Format string.
nz (string) Placeholder for na items.
format parameter depends on the type:
For matrix format parameter works in the same way as `str.format()` (i.e. you can use same format strings as with `str.format()` with `{0}` as a placeholder for the value) with some shorthand "format" options available:
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
For matrix :
format (string) : (string) (Optional) Use `x1` as placeholder for `x1` and so on. E.g. default format is `"(x1, y1) - (x2, y2)"`.
For matrix :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` and `txt` for label's text. E.g. default format is `(x1, y1): "txt"` if ptint_text is true and `(x1, y1)` if false.
For matrix :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` etc. E.g. default format is "(x1, y1) - (x2, y2)".
For matrix :
format (string) : (string) (Optional) Options are "HEX" (e.g. "#FFFFFF33") or "RGB" (e.g. "rgb(122,122,122,23)"). Default is "HEX".
█ FULL LIST OF FUNCTIONS AND PARAMETERS
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format() with some shorthand options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format() with some shorthand options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) Like in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) "HEX" (default) or "RGB"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toStringMx(mx, format, nz)
Returns a string matrix made of original matrix items converted to string with toS().
Namespace types: matrix
Parameters:
mx (matrix)
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) Format string as in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) Like in str.format() with some shorthand options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
--- time ---
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) Format string as in str.format()
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) "HEX" (default) or "RGB"
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
method toS(this, format, nz)
Converts each element of the matrix to string outputs using str.tostring(matrix)
Namespace types: matrix
Parameters:
this (matrix) : (matrix) Matrix to be converted to string
format (string) : (string) (Optional) Format string. By default "{0}: {1}" if showIDs = true or "{1}" otherwise. (use "{0}" as a placeholder for id and "{1}" for item value)
nz (string) : (string) If val is na and nz is not na the value of nz param is returned instead.export method toS(matrix this, string format = "", string nz = na) => str.tostring(this.toStringMx(format, nz))
ToStringAr█ OVERVIEW
Contains to string conversion methods arrays of int/float/bool/string/line/label/box types
- toS() - method works like array.join() with more flexibility and
- toStringAr() - converts array to string on a per item basis and returns the resulting string array
Conversion of each item to string is made using toS() function from moebius1977/ToS/1 library.
█ GENERAL DESCRIPTION OF LIBRARY FUNCTIONS
All toS(array) methods have same parameters. The only difference will be in format parameter as explained below.
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Like array.join() but with string length limit. Joins elements into readable string (length capped at 4000, truncating the end or beg)
Parameters:
this (array) : array to be converted to string
index_from (int) : index_from (int) (Optional) Start from this id (starting from 0, in insertion order). If omitted - start from the first item.
index_to (int) : index_to (int) (Optional) End with this pair (inclusive, in insertion order). If omitted - to last item.
separator (string) : separator (string) (Optional) String to be inserted between pairs. Default: `", "`
showIDs (bool) : showIDs (bool) (Optional) If true item's id is added in the form `id: value`.
format (string) : format (string) (Optional) Format string fo toS(). If omitted default format is used depending in the type.
truncate_left (bool) : truncate_left (bool) (Optional) Truncate from left or right. Default: false.
size_limit (int) : size_limit (int) (Optional) Max output string length. Default: 4000.
nz (string) : nz (string) (Optional) A string used to represent na (na values are substituted with this string).
format parameter depends on the type:
For toS(bool/int/float ...) format parameter works in the same way as `str.format()` (i.e. you can use same format strings as with `str.format()` with `{0}` as a placeholder for the value) with some shorthand "format" options available:
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}" (e.g. " " results in "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}")
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
--- time ---
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}" (e.g. " " results in "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}")
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
For toS(line ...):
format (string) : (string) (Optional) Use `x1` as placeholder for `x1` and so on. E.g. default format is `"(x1, y1) - (x2, y2)"`.
For toS(label ...) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` and `txt` for label's text. E.g. default format is `(x1, y1): "txt"` if ptint_text is true and `(x1, y1)` if false.
For toS(box ... ) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` etc. E.g. default format is "(x1, y1) - (x2, y2)".
For toS(color] ... ) :
format (string) : (string) (Optional) Options are "HEX" (e.g. "#FFFFFF33") or "RGB" (e.g. "rgb(122,122,122,23)"). Default is "HEX".
All toStringAr() methods just convert each item to string using toS with same format options as described above.
Parameters:
arr (array) : Array to be converted to a string array.
format (string) : Format string.
nz (string) : Placeholder for na items.
█ FULL OF FUNCTIONS AND PARAMETERS
Library "ToStringAr"
Contains toString/toS conversion methods for int/float/bool/string/line/label/box and arrays and matrices thereof. Also contains a string wraping function.
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toS(this, index_from, index_to, separator, showIDs, format, truncate_left, size_limit, nz)
Namespace types: array
Parameters:
this (array)
index_from (int)
index_to (int)
separator (string)
showIDs (bool)
format (string)
truncate_left (bool)
size_limit (int)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
method toStringAr(arr, format, nz)
Namespace types: array
Parameters:
arr (array)
format (string)
nz (string)
ToS█ OVERVIEW
Contains methods for conversion to string of simple types int/float/bool/string/line/label/box .
- toS() - For bool/int/float works much the same as str.tostring() with some shorthand formatting options for int/float. For line/label/box displays their text and coordinates automatically formatting x coordinate as time or bar index.
- toShortString() - Converts a number to a short form using "k", "m", "bn" and "T" nominators. (e.g. `12,350` --> `12.4k`).
Supports some shorthand formatting options for int/float and time.
█ HOW TO USE
All toS() methods have the same parameters:
Parameters:
val (int) : A float to be converted to string
format (string) : Format string, which depends on the value type
nz (string) : (string) A string used to represent na (na values are substituted with this string).
For toS(bool/int/float) format parameter works in the same way as `str.format()` (i.e. you can use same format strings as with `str.format()` with `{0}` as a placeholder for the value)
Some shorthand "format" options available:
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "... ... " in any place is substituted with "{0, date, dd.MM.YY}"
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
--- time ---
- "... ... " in any place is substituted with "{0, time, HH.mm.ss}"
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
For toS(line) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x1` and so on. E.g. default format is `"(x1, y1) - (x2, y2)"`.
For toS(label) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` and `txt` for label's text. E.g. default format is `(x1, y1): "txt"` if ptint_text is true and `(x1, y1)` if false.
For toS(box) :
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` etc. E.g. default format is "(x1, y1) - (x2, y2)".
For toS(color) :
format (string) : (string) (Optional) Options are "HEX" (e.g. "#FFFFFF33") or "RGB" (e.g. "rgb(122,122,122,23)"). Default is "HEX".
█ LIST OF FUNCTIONS AND PARAMETERS
method toS(val, format, nz)
Formats the `int/float` in the same way as `str.format()` (i.e. you can use same format strings as with
`str.format()` with `{0}` arg) with some shorthand "format" options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "......" in angular brackets in any place is substituted with "{0, date, dd.MM.YY}"
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
--- time ---
- "......" in angular brackets in any place is substituted with "{0, time, HH.mm.ss}"
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
```
Namespace types: series int, simple int, input int, const int
Parameters:
val (int) : A float to be converted to string
format (string) : Format string (e.g. "0.000" or "date : time" or "HH:mm")
nz (string) : (string) A string used to represent na (na values are substituted with this string).
method toS(val, format, nz)
Formats the `int/float` in the same way as `str.format()` (i.e. you can use same format strings as with
`str.format()` with `{0}` arg) with some shorthand "format" options:
```
--- number ---
- "" => "{0}"
- "number" => "{0}"
- "0" => "{0, number, 0 }"
- "0.0" => "{0, number, 0.0 }"
- "0.00" => "{0, number, 0.00 }"
- "0.000" => "{0, number, 0.000 }"
- "0.0000" => "{0, number, 0.0000 }"
- "0.00000" => "{0, number, 0.00000 }"
- "0.000000" => "{0, number, 0.000000 }"
- "0.0000000" => "{0, number, 0.0000000}"
--- date ---
- "......" in angular brackets in any place is substituted with "{0, date, dd.MM.YY}"
- "date" => "{0, date, dd.MM.YY}"
- "date : time" => "{0, date, dd.MM.YY} : {0, time, HH.mm.ss}"
- "dd.MM" => "{0, date, dd:MM}"
- "dd" => "{0, date, dd}"
--- time ---
- "......" in angular brackets in any place is substituted with "{0, time, HH.mm.ss}"
- "time" => "{0, time, HH:mm:ss}"
- "HH:mm" => "{0, time, HH:mm}"
- "mm:ss" => "{0, time, mm:ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
- "date, time" => "{0, date, dd.MM.YY\}, {0, time, HH.mm.ss}"
- "date,time" => "{0, date, dd.MM.YY\},{0, time, HH.mm.ss}"
- "date time" => "{0, date, dd.MM.YY\} {0, time, HH.mm.ss}"
```
Namespace types: series float, simple float, input float, const float
Parameters:
val (float) : A float to be converted to string
format (string) : Format string (e.g. "0.000" or "date : time" or "HH:mm")
nz (string) : (string) A string used to represent na (na values are substituted with this string).
method toS(val, format, nz)
Formats `bool val` in the same way as `str.format()` (i.e. you can use same format strings as with
`str.format()` with `{0}` placeholder for the `val` argument).
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
val (bool) : (bool) Value to be formatted
format (string)
nz (string) : (string) A string used to represent na (na values are substituted with this string).
method toS(val, format, nz)
Formats `string val` in the same way as `str.format()` (i.e. you can use same format strings as with
`str.format()` with `{0}` placeholder for the `val` argument).
Namespace types: series color, simple color, input color, const color
Parameters:
val (color)
format (string) : (string) "HEX" or "RGB"
nz (string) : (string) A string used to represent na (na values are substituted with this string).
method toS(val, format, nz)
Formats `string val` in the same way as `str.format()` (i.e. you can use same format strings as with
`str.format()` with `{0}` placeholder for the `val` argument).
Namespace types: series string, simple string, input string, const string
Parameters:
val (string)
format (string)
nz (string) : (string) A string used to represent na (na values are substituted with this string).
method toS(ln, format, nz)
Returns line's coordinates as a string (by default in "(x1, y1) - (x2, y2)" format, use `x1`, `y1`, `x2`,`y2` as placeholders in `format` string)). Automatically detects
whether the coordinates are in `xloc.bar_index` or `xloc.bar_time` and displays
accordingly (in _dd.MM.yy HH:mm:ss_ format)
Namespace types: series line
Parameters:
ln (line)
format (string) : (string) (Optional) Use `x1` as placeholder for `x1` and so on. E.g. default format is `"(x1, y1) - (x2, y2)"`.
nz (string) : (string) (Optional) If `val` is `na` and `nz` is not `na` the value of `nz` param is returned instead.
method toS(lbl, format, nz, print_text)
Returns label's coordinates and text as a string (by default in "(x, y): text = ...)" format; use `x1`, `y1`, `txt` as placeholders in `format` string))).
Automatically detects whether the coordinates are in `xloc.bar_index` or `xloc.bar_time` and displays.
accordingly (in _dd.MM.yy HH:mm:ss_ format)
Namespace types: series label
Parameters:
lbl (label)
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` and `txt` for label's text. E.g. default format is `(x1, y1): "txt"`.
nz (string) : (string) A string used to represent na (na values are substituted with this string).
print_text (bool)
method toS(bx, format, nz)
Returns box's coordinates as a string (by default in "(x1, y1) - (x2, y2)" format)
Namespace types: series box
Parameters:
bx (box)
format (string) : (string) (Optional) Use `x1` as placeholder for `x`, `y1 - for `y` etc. E.g. default format is "(x1, y1) - (x2, y2)".
nz (string) : (string) A string used to represent na (na values are substituted with this string).
method toShortString(this, decimals)
Converts number to a short form using "k", "m", "bn" and "T" nominators. (e.g. `12,350` --> `12.4k`).
@this (series float) Number to be converted to short format.
@decimals (series int) Optional argument. Decimal places to which number will be rounded. When no argument
is supplied, rounding is to the nearest integer.
Namespace types: series float, simple float, input float, const float
Parameters:
this (float)
decimals (int)
TimeframeComparisonLibrary "TimeframeComparison"
Timeframe comparison for higher and lower timeframe
█ OVERVIEW
This library is used to compare higher / lower timeframe by using timeframe.multiplier.
minMult()
timeframe multiplier in minutes
Returns: float value
commonThe "Pineify/common" library presents a specialized toolkit crafted to empower traders and script developers with state-of-the-art time manipulation functions on the TradingView platform. It is instead a foundational utility aimed at enriching your script's ability to process and interpret time-based data with unparalleled precision.
Key Features
String Splitter:
The 'str_split_into_two' function is a universal string handler that separates any given input into two distinct strings based on a specified delimiter. This function is especially useful in parsing time strings or any scenario where a string needs to be divided into logical parts efficiently.
Example:
= str_split_into_two("a:b", ":")
// a = "a"
// b = "b"
Time Parser:
With 'time_to_hour_minute', users can effortlessly convert a time string into numerical hours and minutes. This function is pivotal for those who need to exact specific time series data or wish to schedule their trades down to the minute.
Example:
= time_to_hour_minute("02:30")
// time_hour = 2
// time_minute = 30
Unix Time Converter
The 'time_range_to_unix_time' function transcends traditional boundaries by converting a given time range into Unix timestamp format. This integration of date, time, and timezone, accounts for a comprehensive approach, allowing scripts to make timed decisions, perform historical analyses, and account for international markets across different time zones.
Example:
// Support 'hhmm-hhmm' and 'hh:mm-hh:mm'
= time_range_to_unix_time("09:30-12:00")
Summary:
Each function is meticulously designed to minimize complexity and maximize versatility. Whether you are a programmer seeking to streamline your code, or a trader requiring precise timing for your strategies, our library provides the logical framework that aligns with your needs.
The "Pineify/common" library is the bridge between high-level time concepts and actionable trading insights. It serves a multitude of purposes – from crafting elegant time-based triggers to dissecting complex string data. Embrace the power of precision with "Pineify/common" and elevate your TradingView scripting experience to new heights.
SimilarityMeasuresLibrary "SimilarityMeasures"
Similarity measures are statistical methods used to quantify the distance between different data sets
or strings. There are various types of similarity measures, including those that compare:
- data points (SSD, Euclidean, Manhattan, Minkowski, Chebyshev, Correlation, Cosine, Camberra, MAE, MSE, Lorentzian, Intersection, Penrose Shape, Meehl),
- strings (Edit(Levenshtein), Lee, Hamming, Jaro),
- probability distributions (Mahalanobis, Fidelity, Bhattacharyya, Hellinger),
- sets (Kumar Hassebrook, Jaccard, Sorensen, Chi Square).
---
These measures are used in various fields such as data analysis, machine learning, and pattern recognition. They
help to compare and analyze similarities and differences between different data sets or strings, which
can be useful for making predictions, classifications, and decisions.
---
References:
en.wikipedia.org
cran.r-project.org
numerics.mathdotnet.com
github.com
github.com
github.com
Encyclopedia of Distances, doi.org
ssd(p, q)
Sum of squared difference for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Measure of distance that calculates the squared euclidean distance.
euclidean(p, q)
Euclidean distance for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Measure of distance that calculates the straight-line (or Euclidean).
manhattan(p, q)
Manhattan distance for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Measure of absolute differences between both points.
minkowski(p, q, p_value)
Minkowsky Distance for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
p_value (float) : `float` P value, default=1.0(1: manhatan, 2: euclidean), does not support chebychev.
Returns: Measure of similarity in the normed vector space.
chebyshev(p, q)
Chebyshev distance for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Measure of maximum absolute difference.
correlation(p, q)
Correlation distance for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Measure of maximum absolute difference.
cosine(p, q)
Cosine distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The Cosine distance between vectors `p` and `q`.
---
angiogenesis.dkfz.de
camberra(p, q)
Camberra distance for N dimensions.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Weighted measure of absolute differences between both points.
mae(p, q)
Mean absolute error is a normalized version of the sum of absolute difference (manhattan).
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Mean absolute error of vectors `p` and `q`.
mse(p, q)
Mean squared error is a normalized version of the sum of squared difference.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Mean squared error of vectors `p` and `q`.
lorentzian(p, q)
Lorentzian distance between provided vectors.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Lorentzian distance of vectors `p` and `q`.
---
angiogenesis.dkfz.de
intersection(p, q)
Intersection distance between provided vectors.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Intersection distance of vectors `p` and `q`.
---
angiogenesis.dkfz.de
penrose(p, q)
Penrose Shape distance between provided vectors.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Penrose shape distance of vectors `p` and `q`.
---
angiogenesis.dkfz.de
meehl(p, q)
Meehl distance between provided vectors.
Parameters:
p (float ) : `array` Vector with first numeric distribution.
q (float ) : `array` Vector with second numeric distribution.
Returns: Meehl distance of vectors `p` and `q`.
---
angiogenesis.dkfz.de
edit(x, y)
Edit (aka Levenshtein) distance for indexed strings.
Parameters:
x (int ) : `array` Indexed array.
y (int ) : `array` Indexed array.
Returns: Number of deletions, insertions, or substitutions required to transform source string into target string.
---
generated description:
The Edit distance is a measure of similarity used to compare two strings. It is defined as the minimum number of
operations (insertions, deletions, or substitutions) required to transform one string into another. The operations
are performed on the characters of the strings, and the cost of each operation depends on the specific algorithm
used.
The Edit distance is widely used in various applications such as spell checking, text similarity, and machine
translation. It can also be used for other purposes like finding the closest match between two strings or
identifying the common prefixes or suffixes between them.
---
github.com
www.red-gate.com
planetcalc.com
lee(x, y, dsize)
Distance between two indexed strings of equal length.
Parameters:
x (int ) : `array` Indexed array.
y (int ) : `array` Indexed array.
dsize (int) : `int` Dictionary size.
Returns: Distance between two strings by accounting for dictionary size.
---
www.johndcook.com
hamming(x, y)
Distance between two indexed strings of equal length.
Parameters:
x (int ) : `array` Indexed array.
y (int ) : `array` Indexed array.
Returns: Length of different components on both sequences.
---
en.wikipedia.org
jaro(x, y)
Distance between two indexed strings.
Parameters:
x (int ) : `array` Indexed array.
y (int ) : `array` Indexed array.
Returns: Measure of two strings' similarity: the higher the value, the more similar the strings are.
The score is normalized such that `0` equates to no similarities and `1` is an exact match.
---
rosettacode.org
mahalanobis(p, q, VI)
Mahalanobis distance between two vectors with population inverse covariance matrix.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
VI (matrix) : `matrix` Inverse of the covariance matrix.
Returns: The mahalanobis distance between vectors `p` and `q`.
---
people.revoledu.com
stat.ethz.ch
docs.scipy.org
fidelity(p, q)
Fidelity distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The Bhattacharyya Coefficient between vectors `p` and `q`.
---
en.wikipedia.org
bhattacharyya(p, q)
Bhattacharyya distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The Bhattacharyya distance between vectors `p` and `q`.
---
en.wikipedia.org
hellinger(p, q)
Hellinger distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The hellinger distance between vectors `p` and `q`.
---
en.wikipedia.org
jamesmccaffrey.wordpress.com
kumar_hassebrook(p, q)
Kumar Hassebrook distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The Kumar Hassebrook distance between vectors `p` and `q`.
---
github.com
jaccard(p, q)
Jaccard distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The Jaccard distance between vectors `p` and `q`.
---
github.com
sorensen(p, q)
Sorensen distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
Returns: The Sorensen distance between vectors `p` and `q`.
---
people.revoledu.com
chi_square(p, q, eps)
Chi Square distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
eps (float)
Returns: The Chi Square distance between vectors `p` and `q`.
---
uw.pressbooks.pub
stats.stackexchange.com
www.itl.nist.gov
kulczynsky(p, q, eps)
Kulczynsky distance between provided vectors.
Parameters:
p (float ) : `array` 1D Vector.
q (float ) : `array` 1D Vector.
eps (float)
Returns: The Kulczynsky distance between vectors `p` and `q`.
---
github.com
TooltipLibrary "Tooltip"
This library helps creating and managing nice looking data (key/value) tooltips that you can use for
labels. The tooltips data key/value will align automatically. It is optional to convert the data to a values only string too.
method addSpacesToKey(this)
Calculates the amount of spaces needed after the key to make it the key least 4 characters wide.
Namespace types: Data
Parameters:
this (Data) : (Data) The Data.
method addTabs(this, longestKeyLength)
Calculates the amount of tabs to be used.
Namespace types: Data
Parameters:
this (Data) : (Data) The Data.
longestKeyLength (int)
method longestKeyLength(this)
Returns the length of the longest key string in the array.
Namespace types: Data
Parameters:
this (Data ) : (Tooltip) The object to work with.
@return (int) The length of the key.
method toString(tooltips, withKey)
Helper function for the tooltip.
Namespace types: Data
Parameters:
tooltips (Data )
withKey (bool) : (bool) Wether to create a string with keys in it.
@return (string) The string
new()
Creates a new array to store tooltip data in
@return (Data) The data array.
Data
Key/Value pair for tooltips
Fields:
key (series string)
value (series string)
.print()
You don't need to initialize anything..
After you import the library you can use .print() as easy as that..!
Hope this helps
* use a unique ID for each .print() call
let me know if you run into any bugs
by trying to make it as user friendly as possible i had to do
some not ideal things so there's a chance it could present some bugs with
a lot of labels present on the chart
and if you use label.all to parse and manipulate the labels on the chart..
most likely it will cause an issue but not a lot of people use this so
I don't think that will be a problem.
thanks,
FFriZz | frizlabz
Library "print"
Single function to print any type to console
method str(inp)
`method` convert all types to string
```
(overload)
*.str(any inp) => string
```
Namespace types: series string, simple string, input string, const string
Parameters:
inp (string) : `any` - desc | Required
Returns: `string` formatted string
method str(inp)
Namespace types: series int, simple int, input int, const int
Parameters:
inp (int)
method str(inp)
Namespace types: series float, simple float, input float, const float
Parameters:
inp (float)
method str(inp)
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
inp (bool)
method str(inp)
Namespace types: series linefill
Parameters:
inp (linefill)
method str(inp)
Namespace types: series line
Parameters:
inp (line)
method str(inp)
Namespace types: series box
Parameters:
inp (box)
method str(inp)
Namespace types: series label
Parameters:
inp (label)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: matrix
Parameters:
inp (matrix)
method str(inp)
Namespace types: linefill
Parameters:
inp (linefill )
method str(inp)
Namespace types: line
Parameters:
inp (line )
method str(inp)
Namespace types: box
Parameters:
inp (box )
method str(inp)
Namespace types: label
Parameters:
inp (label )
method str(inp)
Namespace types: string
Parameters:
inp (string )
method str(inp)
Namespace types: int
Parameters:
inp (int )
method str(inp)
Namespace types: float
Parameters:
inp (float )
method str(inp)
Namespace types: bool
Parameters:
inp (bool )
method arrayShorten(str)
arrayShorten
Namespace types: series string, simple string, input string, const string
Parameters:
str (string) : `string` - the string to shorten | Required
Returns: `string` - a shortened version of the input string if it is an array with more than 7 elements, otherwise the original string
method matrixShorten(str)
matrixShorten
Namespace types: series string, simple string, input string, const string
Parameters:
str (string) : `string` - the string to shorten | Required
Returns: `string` - the shortened matrix string if the input is a matrix, otherwise returns the input string as is
method print(x, ID)
print all types to theh same console with just this `method/function`
```
(overload)
*.print(any x, string ID, bool shorten=true?) => console
"param 'shorten' - only for arrays and matrixs" | true
```
Namespace types: series string, simple string, input string, const string
Parameters:
x (string) : - `any` input to convert
ID (string) : - `string` unique id for label on console `MUST BE UNIQUE`
Returns: adds the `ID` and the `inp` to the console on the chart
method print(x, ID)
Namespace types: series float, simple float, input float, const float
Parameters:
x (float)
ID (string)
method print(x, ID)
Namespace types: series int, simple int, input int, const int
Parameters:
x (int)
ID (string)
method print(x, ID)
Namespace types: series box
Parameters:
x (box)
ID (string)
method print(x, ID)
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
x (bool)
ID (string)
method print(x, ID)
Namespace types: series label
Parameters:
x (label)
ID (string)
method print(x, ID)
Namespace types: series line
Parameters:
x (line)
ID (string)
method print(x, ID)
Namespace types: series linefill
Parameters:
x (linefill)
ID (string)
method print(x, ID, shorten)
Namespace types: string
Parameters:
x (string )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: float
Parameters:
x (float )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: int
Parameters:
x (int )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: box
Parameters:
x (box )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: bool
Parameters:
x (bool )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: label
Parameters:
x (label )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: line
Parameters:
x (line )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: linefill
Parameters:
x (linefill )
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
method print(x, ID, shorten)
Namespace types: matrix
Parameters:
x (matrix)
ID (string)
shorten (bool)
string_utilsLibrary "string_utils"
Collection of string utilities that can be used to replace sub-strings in a string and string functions
that are not part of the standard library.
This a more simple replacement of my previous string_variables library since it uses types for better
performance due to data locality and methods that give a more intuitive API.
UnispacesLibrary "Unispaces"
Easier than looking up unicode spaces
spaces(sequence, string1, string2)
UNISPACES
Parameters:
sequence : (int) required | 123 = 3 spaces / 3 different sizes (one space per number can find spaces in hover over)
string1 : (str) optional | default = ""
string2 : (str) optional | default = ""
Returns: `string - concatenated string surrounding unispaces`
space(space, string1, string2)
UNISPACE
Parameters:
space : (int) optional | default = 0 | 0-15 (can find spaces in hover over)
string1 : (str) optional | default = ""
string2 : (str) optional | default = ""
Returns: `string - concatenated string surrounding a unispace `
Sub-Super Script and Roman numerals LibraryLibrary "Sub_Super_Script_and_RomanNumerals_Library"
Library to transform numbers into Roman numerals / Super-Sub script / check if value is alpha or number
isnumber(input)
check to see if value is a number
Parameters:
input : (string/float/int) value to check
Returns: (na) if value is NOT a number and input (string/float/int) if value is a number
isalpha(input)
check a string if it is alpha(doesnt contain numbers)
Parameters:
input
Returns: (string) if string input does NOT contain numbers, return (na) if input string contains numbers
super(num)
convert a string's numbers from normal print to super-script
Parameters:
num : (string/int/float) input value to transform
Returns: string of input with numbers converted to super-script
sub(num)
convert a string's numbers from normal print to sub-script
Parameters:
num : (string/int/float) input value to transform
Returns: string of input with numbers converted to sub-script
roman(num, trunc)
convert a string of numbers, float, or int
Parameters:
num : (string) input number to transform
trunc : (bool | false) true to truncate float value, false to show roman numerals with decimals (XX.VI)
Returns: string of roman numerals representing the input (num)
String_Encoder_DecoderLibrary "String_Encoder_Decoder"
String encoder and decoder to use in internal data tranfer in script calculations.
In example, script encode 125 values once and then decode them every candle.
encode(array or values (val1,val2,val3,val4,val5,val6)
encode: encode some values into string
Parameters:
array : of values or values1, value2 (up to 6 values)
(input values must be stringified)
Returns: encoded value
decode(val)
decode: decode into string
Parameters:
val : value to decode, must be stringified
Returns: decoded array of stringified values
intoLibrary "into"
convert literals by type,
Same-types left in for bulk reasons.
TODO: Expand Types
b(string)
Convert string to bool.
Parameters:
string : val A string value.
Returns: Bool.
b(bool)
Pass Bool/bool
Parameters:
bool :
Returns: Bool.
b(float)
Convert Float (True if exists and not 0)
Parameters:
float : val A float value.
Returns: Bool.
b(int)
Convert integer (True if exists and not 0)
Parameters:
int : val An integer value.
Returns: Bool.
f(bool)
Convert bool to float.
Parameters:
bool : val A boolean value.
Returns: Float.
f(string, int)
Convert with decimal
Parameters:
string : val A string value.
int : decimals Decimal places. def = 6
Returns: Float.
f(float, int)
Convert float bypass with decimals
Parameters:
float : val A float value.
int : decimals Decimal places. def = 6
Returns: Float.
f(int)
Convert integer to float.
Parameters:
int : val An integer value.
Returns: Float.
i(bool)
Convert bool to int.
Parameters:
bool : val A boolean value.
Returns: Int.
i(string)
Convert string number to int.
Parameters:
string : val A string value.
Returns: Int.
i(float)
Convert float to int.
Parameters:
float : val A float value.
Returns: Int.
i(int)
Convert int to int.
Parameters:
int : val An int value.
Returns: Int.
s(bool)
Convert bool value to string.
Parameters:
bool : val A boolean value.
Returns: String.
s(str)
bypass string
Parameters:
str : val A string value.
Returns: String.
s(float)
Convert float value to string.
Parameters:
float : val A float value.
Returns: String.
s(int)
Convert int value to string.
Parameters:
int : val An integer value.
Returns: String.
s(val)
Array Convert Each Item
Parameters:
val : Array Input (Str,Bool,Int,Float)
Returns: String.
s(val)
Array Convert Each Item
Parameters:
val : Array Input (Str,Bool,Int,Float)
Returns: String.
s(val)
Array Convert Each Item
Parameters:
val : Array Input (Str,Bool,Int,Float)
Returns: String.
s(val)
Array Convert Each Item
Parameters:
val : Array Input (Str,Bool,Int,Float)
Returns: String.
fontLibrary "font"
Unicode Characters Replacement function for strings.
uni(_str, _number)
Unicode Font Substitutee
Parameters:
_str : Input Strinbg
_number : Font by Int input
uni(_str, _number)
Unicode Font Substitutee
Parameters:
_str : Input Strinbg
_number : Font by Name input
DateNow█ OVERVIEW
Library "DateNow"
TODO: Provide today's date based on UNIX time
█ INSPIRATIONS
Use pinescript v4 functions such as year(), month() and dayofmonth().
Use pinescript v5 function such as switch.
Export as string variables.
Not using any match function such as math.floor.
█ CREDITS
RicardoSantos
█ KNOWN ISSUES
Date for Day display incorrectly by shortage 1 value especially Year equal to or before 1984
Timezone issue. Example : I using GMT+8 for my timezone, try using other GMT will not work. Al least, GMT+2 to GMT+13 is working. GMT-0 to GMT+1 is not working, although already attempt using UTC-10 to UTC-1.
dateNow()
: DateNow
Parameters:
: : _timezone
Returns: : YYYY, YY, M, MM, MMM, DD
functionStringToMatrixLibrary "functionStringToMatrix"
Provides unbound methods (no error checking) to parse a string into a float or int matrix.
to_matrix_float(str, interval_sep, start_tk, end_tk)
Parse a string into a float matrix.
Parameters:
str : , string, the formated string to parse.
interval_sep : , string, cell interval separator token.
start_tk : , string, row start token.
end_tk : , string, row end token.
Returns: matrix, parsed float matrix.
to_matrix_int(str, interval_sep, start_tk, end_tk)
Parse a string into a int matrix.
Parameters:
str : , string, the formated string to parse.
interval_sep : , string, cell interval separator token.
start_tk : , string, row start token.
end_tk : , string, row end token.
Returns: matrix, parsed int matrix.
HarmonicSwitches█ OVERVIEW
This library is complementary for XABCD Harmonic Pattern Custom Range Interactive
TupleSwitchHL()
: Tuple Switch for High Low
Parameters:
: : _bool, low_X, high_X, low_A, high_A, low_B, high_B, low_C, high_C
Returns: : price_X, price_A, price_B, price_C
TupleSwitchStyleColor()
: Tuple switch for style and color
Parameters:
: : _bool
Returns: : style0, style1, col_dir
TupleSwitchString()
: Tuple switch for string
Parameters:
: : _bool
Returns: : str_dir, str_X, str_A
TupleSwitchValid()
: Tuple switch for valid
Parameters:
: : _str
Returns: : str_invalid, str_valid
TupleSwitchTime()
: Tuple switch for time
Parameters:
: : _str, time_1, time_2, time_3
Returns: : E1, E2
SwitchColor()
: Switch color
Parameters:
: : _str
Returns: : col_valid
SwitchExtend()
: Extend line
Parameters:
: : _str
Returns: : _extend
srcCalcLibrary "srcCalc"
Provides functions for converting input strings 'open','high','low','close','hl2','hlc3','ohlc4','hlcc4' to corresponding source values.
get_src(src)
Converts string to source float value
Parameters:
src : String to use (`close` is used if no argument is supplied).
Returns: Returns the float value of the string
HarmonicCalculation█ OVERVIEW
This library is complementary for XABCD Harmonic Pattern Custom Range Interactive
PriceDiff()
: Price Difference
Parameters:
: : price_1, price_2
Returns: : PriceDiff
TimeDiff()
: Time Difference
Parameters:
: : time_1, time_2
Returns: : TimeDiff
ReturnIndexOf3Arrays()
: Return Index Of 3 Arrays
Parameters:
: : id1, id2, id3, _int
Returns: : ReturnIndexOf3Arrays
AbsoluteRange()
: Price Difference
Parameters:
: : price, y, point
Returns: : AbsoluteRange
PriceAverage()
: To calculate average of 2 prices
Parameters:
: : price_1, price_2
Returns: : PriceAverage
TimeAverage()
: To calculate average of 2 times
Parameters:
: : time_1, time_2
Returns: : TimeAverage
StringBool()
: To show ratio in 3 decimals format
Parameters:
: : _value, _bool, _text
Returns: : StringBool
PricePercent()
: To show Price in percent format
Parameters:
: : _price, PriceRef, str_dir
Returns: : PricePercent
BoolCurrency()
: To show syminfo.currency
Parameters:
: : _bool
Returns: : BoolCurrency
RatioText()
: To show RatioText in 3 decimals format
Parameters:
: : _value, _text
Returns: : RatioText
RangeText()
: To display RangeText in Harmonic Range Format
Parameters:
: : _id1, _id2, _int, _text
Returns: : RangeText
PriceCurrency()
: To show Currency in Price Format
Parameters:
: : _bool, _value
Returns: : PriceCurrency