PINE LIBRARY

debug

アップデート済
Library "debug"
Show Array or Matrix Elements In Table

Use anytime you want to see the elements in an array or a matrix displayed.
Effective debugger, particularly for strategies and complex logic structures.

Look in code to find instructions. Reach out if you need assistance.

Functionality includes:
  • Viewing the contents of an array or matrix on screen.
  • Track variables and variable updates using debug()
  • Track if and when local scopes fire using debugs()


Types Allowed:
  • string
  • float
  • int
  • string


debug(_col, _row, _name, _value, _msg, _ip)
  Debug Variables in Matrix
  Parameters:
    _col (int): (int) Assign Column
    _row (int): (int) Assign Row
    _name (matrix<string>): (simple matrix) Matrix Name
    _value (string): (string) Assign variable as a string (str.tostring())
    _msg (string)
    _ip (int): (int) (default 1) 1 for continuous updates. 2 for barstate.isnew updates. 3 for barstate.isconfirmed updates. -1 to only add once
  Returns: Returns Variable _value output and _msg formatted as '_msg: variableOutput' in designated column and row

debug(_col, _row, _name, _value, _msg, _ip)
  Parameters:
    _col (int)
    _row (int)
    _name (matrix<string>)
    _value (float)
    _msg (string)
    _ip (int)

debug(_col, _row, _name, _value, _msg, _ip)
  Parameters:
    _col (int)
    _row (int)
    _name (matrix<string>)
    _value (int)
    _msg (string)
    _ip (int)

debug(_col, _row, _name, _value, _msg, _ip)
  Parameters:
    _col (int)
    _row (int)
    _name (matrix<string>)
    _value (bool)
    _msg (string)
    _ip (int)

debugs(_col, _row, _name, _msg)
  Debug Scope in Matrix - Identify When Scope Is Accessed
  Parameters:
    _col (int): (int) Column Number
    _row (int): (int) Row Number
    _name (matrix<string>): (simple matrix) Matrix Name
    _msg (string): (string) Message
  Returns: Message appears in debug panel using _col/_row as the identifier

viewArray(_arrayName, _pos, _txtSize, _tRows, s_index, s_border, _rowCol, bCol, _fillCond, _offset)
  Array Element Display (Supports float[], int[], string[], and bool[])
  Parameters:
    _arrayName (float[]): ID of Array to be Displayed
    _pos (string): Position for Table
    _txtSize (string): Size of Table Cell Text
    _tRows (int): Number of Rows to Display Data In (columns will be calculated accordingly)
    s_index (bool): (Optional. Default True.) Show/Hide Index Numbers
    s_border (bool): (Optional. Default False.) Show/Hide Border
    _rowCol (string)
    bCol (color): = (Optional. Default Black.) Frame/Border Color.
    _fillCond (bool): (Optional) Conditional statement. Function displays array only when true. For instances where size is not immediately known or indices are na. Default = true, indicating array size is set at bar_index 0.
    _offset (int): (Optional) Use to view historical array states. Default = 0, displaying realtime bar.
  Returns: A Display of Array Values in a Table

viewArray(_arrayName, _pos, _txtSize, _tRows, s_index, s_border, _rowCol, bCol, _fillCond, _offset)
  Parameters:
    _arrayName (int[])
    _pos (string)
    _txtSize (string)
    _tRows (int)
    s_index (bool)
    s_border (bool)
    _rowCol (string)
    bCol (color)
    _fillCond (bool)
    _offset (int)

viewArray(_arrayName, _pos, _txtSize, _tRows, s_index, s_border, _rowCol, bCol, _fillCond, _offset)
  Parameters:
    _arrayName (string[])
    _pos (string)
    _txtSize (string)
    _tRows (int)
    s_index (bool)
    s_border (bool)
    _rowCol (string)
    bCol (color)
    _fillCond (bool)
    _offset (int)

viewArray(_arrayName, _pos, _txtSize, _tRows, s_index, s_border, _rowCol, bCol, _fillCond, _offset)
  Parameters:
    _arrayName (bool[])
    _pos (string)
    _txtSize (string)
    _tRows (int)
    s_index (bool)
    s_border (bool)
    _rowCol (string)
    bCol (color)
    _fillCond (bool)
    _offset (int)

viewMatrix(_matrixName, _pos, _txtSize, s_index, _resetIdx, s_border, bCol, _fillCond, _offset)
  Matrix Element Display (Supports <float>, <int>, <string>, and <bool>)
  Parameters:
    _matrixName (matrix<float>): ID of Matrix to be Displayed
    _pos (string): Position for Table
    _txtSize (string): Size of Table Cell Text
    s_index (bool): (Optional. Default True.) Show/Hide Index Numbers
    _resetIdx (bool)
    s_border (bool): (Optional. Default False.) Show/Hide Border
    bCol (color): = (Optional. Default Black.) Frame/Border Color.
    _fillCond (bool): (Optional) Conditional statement. Function displays matrix only when true. For instances where size is not immediately known or indices are na. Default = true, indicating matrix size is set at bar_index 0.
    _offset (int): (Optional) Use to view historical matrix states. Default = 0, displaying realtime bar.
  Returns: A Display of Matrix Values in a Table

viewMatrix(_matrixName, _pos, _txtSize, s_index, _resetIdx, s_border, bCol, _fillCond, _offset)
  Parameters:
    _matrixName (matrix<int>)
    _pos (string)
    _txtSize (string)
    s_index (bool)
    _resetIdx (bool)
    s_border (bool)
    bCol (color)
    _fillCond (bool)
    _offset (int)

viewMatrix(_matrixName, _pos, _txtSize, s_index, _resetIdx, s_border, bCol, _fillCond, _offset)
  Parameters:
    _matrixName (matrix<string>)
    _pos (string)
    _txtSize (string)
    s_index (bool)
    _resetIdx (bool)
    s_border (bool)
    bCol (color)
    _fillCond (bool)
    _offset (int)

viewMatrix(_matrixName, _pos, _txtSize, s_index, _resetIdx, s_border, bCol, _fillCond, _offset)
  Parameters:
    _matrixName (matrix<bool>)
    _pos (string)
    _txtSize (string)
    s_index (bool)
    _resetIdx (bool)
    s_border (bool)
    bCol (color)
    _fillCond (bool)
    _offset (int)
リリースノート
v2
Minor Update. Pushed text alignment for multi line table boxes to top left. Also, given how it's built I can't really make too much customizable, but I did add a text color modifier. So nothing huge, but the alignment change is going to help me out with my project.

Updated:
viewArray(_arrayName, _pos, _txtSize, _tRows, s_index, s_border, _rowCol, bCol, txtCol, _fillCond, _offset)
  Parameters:
    _arrayName (bool[])
    _pos (string)
    _txtSize (string)
    _tRows (int)
    s_index (bool)
    s_border (bool)
    _rowCol (string)
    bCol (color)
    txtCol (color)
    _fillCond (bool)
    _offset (int)

viewMatrix(_matrixName, _pos, _txtSize, s_index, _resetIdx, s_border, bCol, txtCol, _fillCond, _offset)
  Parameters:
    _matrixName (matrix<bool>)
    _pos (string)
    _txtSize (string)
    s_index (bool)
    _resetIdx (bool)
    s_border (bool)
    bCol (color)
    txtCol (color)
    _fillCond (bool)
    _offset (int)
arrayarraydisplayarraysarraytestarrayutilsdebugdebuggerdebuggingdisplaymatrixmatrixdisplaymatrixutils

Pineライブラリ

TradingViewの精神に則り、作者はPineコードをオープンソースライブラリとして公開し、コミュニティの他のPineプログラマーが再利用できるようにしました。作者に敬意を表します!このライブラリを個人的に、または他のオープンソースの投稿で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。


他のメディア:

免責事項