faiyaz7283

_helpers

faiyaz7283 Atualizado   
Library "_helpers"
A library containing helper functions.

_arrayFill(int, string) Fill a string array with given size and value.
  Parameters:
    int: size Total size of array.
    string: value The value used for filling. (`NaN` is used if no argument is supplied).
  Returns: A string array filled with given value.

_arrayFill(int, float) Fill a float array with given size and value.
  Parameters:
    int: size Total size of array.
    float: value The value used for filling.
  Returns: A float array filled with given value.

_arrayFill(int, int) Fill an int array with given size and value.
  Parameters:
    int: size Total size of array.
    int: value The value used for filling.
  Returns: A int array filled with given value.

_arrayFill(int, bool) Fill a boolean array with given size and value.
  Parameters:
    int: size Total size of array.
    bool: value The value used for filling.
  Returns: A boolean array filled with given value.

_bool(bool) Convert bool to bool.
  Parameters:
    bool: val A boolean value.
  Returns: Bool.

_bool(string) Convert string to bool.
  Parameters:
    string: val A string value.
  Returns: Bool.

_bool(float) Convert float to bool.
  Parameters:
    float: val A float value.
  Returns: Bool.

_bool(int) Convert integer to bool.
  Parameters:
    int: val An integer value.
  Returns: Bool.

_float(bool) Convert bool to float.
  Parameters:
    bool: val A boolean value.
  Returns: Float.

_float(string) Convert string number to float.
  Parameters:
    string: val A string value.
  Returns: Float.

_float(float) Convert float to float.
  Parameters:
    float: val A float value.
  Returns: Float.

_float(int) Convert integer to float.
  Parameters:
    int: val An integer value.
  Returns: Float.

_int(bool) Convert bool to int.
  Parameters:
    bool: val A boolean value.
  Returns: Int.

_int(string) Convert string number to int.
  Parameters:
    string: val A string value.
  Returns: Int.

_int(float) Convert float to int.
  Parameters:
    float: val A float value.
  Returns: Int.

_int(int) Convert int to int.
  Parameters:
    int: val An int value.
  Returns: Int.

_str(bool) Convert bool value to string.
  Parameters:
    bool: val A boolean value.
  Returns: String.

_str( str ) Convert string value to string.
  Parameters:
    str: val A string value.
  Returns: String.

_str(float) Convert float value to string.
  Parameters:
    float: val A float value.
  Returns: String.

_str(int) Convert int value to string.
  Parameters:
    int: val An integer value.
  Returns: String.

_join(array, string) Convert a string array to a string using the given separator.
  Parameters:
    array: arr A string array.
    string: separator A separator. (`,` is used if no argument is supplied).
  Returns: A string.

_join(array, string) Convert an int array to a string using the given separator.
  Parameters:
    array: arr An integer array.
    string: separator A separator. (`,` is used if no argument is supplied).
  Returns: A tring.

_join(array, string) Convert a float array to a string using the given separator.
  Parameters:
    array: arr A float array.
    string: separator A separator. (`,` is used if no argument is supplied).
  Returns: A string.

_join(array, string) Convert a boolean array to a string using the given separator.
  Parameters:
    array: arr A bool array.
    string: separator A separator. (`,` is used if no argument is supplied).
  Returns: A string.

_commaSplit(string) Split a string by comma.
  Parameters:
    string: val A comma separated string value.
  Returns: An array.

_commaSplit(string, int) Get an item of a given index from a comma separated value.
  Parameters:
    string: val A comma separated string value.
    int: idx The index of the searching item.
  Returns: String.

_commaSplitPair(string) Get the first pair of values as tuple from a comma separated value.
  Parameters:
    string: val A comma separated string value.
  Returns: String tuple - .

_commaSplitShift(string) Get an array from given comma separated value, minus the first item.
  Parameters:
    string: val A comma separated string value.
  Returns: An array.

_colonSplit(string) Split a string by colon.
  Parameters:
    string: val A colon separated string value.
  Returns: An array.

_colonSplit(string, int) Get an item of a given index from a colon separated value.
  Parameters:
    string: val A colon separated string value.
    int: idx The index of the searching item.
  Returns: String.

_colonSplitPair(string) Get the first pair of values as tuple from a colon separated value.
  Parameters:
    string: val A colon separated string value.
  Returns: String tuple - .

_colonSplitShift(string) Get an array from given colon separated value, minus the first item.
  Parameters:
    string: val A colon separated string value.
  Returns: An array.

_print(bool, string, string) Print a bool value using table.
  Parameters:
    bool: val A bool value.
    string: text_size The size of the text value. ç
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cell.

_print(array, string, string) Print a bool array using table.
  Parameters:
    array: arr A bool array.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cells.

_print(string, string, string) Print a string value using table.
  Parameters:
    string: val A string value.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cell.

_print(array, string, string) Print a string array using table.
  Parameters:
    array: arr A string array.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cells.

_print(float, string, string) Print a float value using table.
  Parameters:
    float: val A float value.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cell.

_print(array, string, string) Print a float array using table.
  Parameters:
    array: arr A float array.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cells.

_print(int, string, string) Print an integer value using table.
  Parameters:
    int: val An integer value.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cell.

_print(array, string, string) Print an int array using table.
  Parameters:
    array: arr An Int array.
    string: text_size The size of the text value. (`size.auto` is used if no argument is supplied).
    string: position The positioin of the printing table. (`position.middle_center` is used if no argument is supplied).
  Returns: Table cells.

_rndmLetter() Random letter generator.
  Returns: Random integer value.

_rndmWord(int) Random word generator.
  Parameters:
    int: size Total size for word's letter count. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
  Returns: Random word.

_rndmSentence(int) Random sentence generator.
  Parameters:
    int: size Total size for sentence word count. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
  Returns: Random sentence.

_rndmBool() Random boolean generator.
  Returns: Random boolean value.

_rndmFloat(float, float) Random float number generator.
  Parameters:
    float: min Minimum float value. (`0` is used if no argument is supplied).
    float: max Maximum float value. (`100` is used if no argument is supplied).
  Returns: Random float value.

_rndmInt(int, int) Random integer number generator.
  Parameters:
    int: min Minimum int value. (`1` is used if no argument is supplied).
    int: max Maximum int value. (`100` is used if no argument is supplied).
  Returns: Random integer value.

_rndmStringArray(int) Random string array generator.
  Parameters:
    int: size Total array size. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
  Returns: Random string array.

_rndmFloatArray(int, float, float) Random float array generator.
  Parameters:
    int: size Int value for total array size. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
    float: min Minimum float value. (`3` is used if no argument is supplied).
    float: max Maximum float value. (`10` is used if no argument is supplied).
  Returns: Random float array.

_rndmIntArray(int, int, int) Random int array generator.
  Parameters:
    int: size Int value for total array size. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
    int: min Minimum int value. (`3` is used if no argument is supplied).
    int: max Maximum int value. (`10` is used if no argument is supplied).
  Returns: Random int array.

_rndmBoolArray(int) Random bool array generator.
  Parameters:
    int: size Int value for total array size. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
  Returns: Random bool array.
Notas de Lançamento:
v2

Updated:
_float(int, int) Convert integer to float using given precision.
  Parameters:
    int: val An integer value.
    int: precision Decimal places.
  Returns: Float.

_rndmFloat(float, float, int) Random float number generator.
  Parameters:
    float: min Minimum float value. (`0` is used if no argument is supplied).
    float: max Maximum float value. (`100` is used if no argument is supplied).
    int: precision Decimal places. (`2` is used if no argument is supplied).
  Returns: Random float value.

_rndmFloatArray(int, float, float, int) Random float array generator.
  Parameters:
    int: size Int value for total array size. (`0` is used if no argument is supplied, which implies random value betweek 3-10).
    float: min Minimum float value. (`3` is used if no argument is supplied).
    float: max Maximum float value. (`10` is used if no argument is supplied).
    int: precision Decimal places. (`2` is used if no argument is supplied).
  Returns: Random float array.
Notas de Lançamento:
v3
Notas de Lançamento:
v4

Chart update.
Notas de Lançamento:
v5

Added:
Support for converting color object to a string ("r|g|b|t") using `_colorToString(color)` or `_str(color)`, and re-convert that back to a color using `_colorFromString(string)` or `_clr(string)`.

Faiyaz Haider
Biblioteca do Pine

No verdadeiro espírito TradingView, o autor publicou este código de Pine como uma biblioteca de código aberto para que outros programadores de Pine de nossa comunidade possam reutilizá-lo. Um brinde ao autor! Você pode usar esta biblioteca em particular ou em outras publicações de código aberto, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Gostaria de usar essa biblioteca?

Copie a seguinte linha e cole-a em seu script.