TradingView
kaigouthro
Jul 20, 2022 12:49 AM

MiteTricks 

Bitcoin / TetherUS PERPETUAL CONTRACTBinance

描述

Library "MiteTricks"

Matrix Global Registry.

Get, Set, automatic growing, universal get/set,
multi-matrix dictionaries, multi-dictionary matrixes..
add slice matrixes of any type, share one common global key registry
pull up an item from a category, and item name ie a table of info.
same cell needs a color, a size, a string, a value, etc..
all of which can be pulled up with the same group id, and key id.
just swap which matrix you pull the value from.
this has a side benefit of non-repainting and recalculating
when pulling values, changing inputs..
makes for very fast/clean usage..

benefit :

floats = value
strings = names
lines = drawn items
table =table of data items for this key
colors = color for line/table/fill,label..

all of those can be pulled with "get(_VALUES,_groupIDX,_keyIDX)" where only the values matrix needs be swapped, and the same item/coordinates remains for all the possible matrixes that item appears in.

also useful as a dictionary/registry for any given type of item,,
and goes very handy with floats/strings/colors/bools with my matrixautotable
very helpful when prototyping or doing development work as a shortcut.

initRegistry()
  Registry inititalizer
  Returns: registry of string matrix type

newbool(optional, optional, optional)
  create bool type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is bool (na)
  Returns: bool matrix of specified size and fill, or blank 2x2 for registry use

newbox(optional, optional, optional)
  create box type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is box (na)
  Returns: box matrix of specified size and fill, or blank 2x2 for registry use

newcolor(optional, optional, optional)
  create color type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is color (na)
  Returns: color matrix of specified size and fill, or blank 2x2 for registry use

newfloat(optional, optional, optional)
  create float type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is float (na)
  Returns: float matrix of specified size and fill, or blank 2x2 for registry use

newint(optional, optional, optional)
  create int type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is int (na)
  Returns: int matrix of specified size and fill, or blank 2x2 for registry use

newlabel(optional, optional, optional)
  create label type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is label (na)
  Returns: label matrix of specified size and fill, or blank 2x2 for registry use

newline(optional, optional, optional)
  create line type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is line (na)
  Returns: line matrix of specified size and fill, or blank 2x2 for registry use

newlinefill(optional, optional, optional)
  create linefill type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is linefill(na)
  Returns: linefill matrix of specified size and fill, or blank 2x2 for registry use

newstring(optional, optional, optional)
  create string type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is string (na)
  Returns: string matrix of specified size and fill, or blank 2x2 for registry use

newtable(optional, optional, optional)
  create table type new matrix presized 2x2 for reg
  Parameters:
    optional: row size
    optional: column size
    optional: fill value(default is table (na)
  Returns: table matrix of specified size and fill, or blank 2x2 for registry use

newfrom(INIT_FILL)
  newfrom Matrix full of item input
  Parameters:
    INIT_FILL: item to fill (2x2) the matri and set type. a type(na) works

addrow(m, v)
  addrow Add new row to matrix
  Parameters:
    m: matrix of type being added to
    v: value of type being added to ( best leave NA on string for registry purposes)

addcolumn(matrix, value)
  addcolumn
  Parameters:
    matrix: of type being added to
    value: of type being added to ( best leave NA on string for registry purposes)

get(_VALS, _KEYREG, _GROUP, _KEY)
  get Grabs value and returns single item
  Parameters:
    _VALS: Matrix Values slice
    _KEYREG: Registry values matrix (strings)
    _GROUP: name of group/category or int group key
    _KEY: name of item to fetch from value registry or int key id
  Returns: item

get(_VALS, _GROUP, _KEY)
  get Grabs value and returns single item
  Parameters:
    _VALS: Matrix Values slice
    _GROUP: name of group/category
    _KEY: name of item to fetch from value registry


getgid(_KEYREG, _GROUP)
  getgid
  Parameters:
    _KEYREG: Reg to pull group id from
    _GROUP: group index int, or string name to get the other missing type


getkid(_KEYREG, _GROUP, _KEY)
  getkid
  Parameters:
    _KEYREG: Reg to pull Key id from
    _GROUP: group index int, or string name
    _KEY: index of string key id to get it's ID int

getkey(_KEYREG, _GROUP, _KEY)
  getkey
  Parameters:
    _KEYREG: Reg to pull Key id from
    _GROUP: group index int, or string name for getting key string
    _KEY: index of string key id to get it's match of other type

set(_VALS, _KEYREG, _GROUP, _KEY, _value)
  set items to reg and matrix container
  Parameters:
    _VALS: Values matrix container
    _KEYREG: Key registry
    _GROUP: (string) Group/Category name
    _KEY: (string) Key for item
    _value: item
  Returns: void

del(_VALS, _KEYREG, _GROUP, _KEY)
  del grroup id
  Parameters:
    _VALS: Matrix Values slice
    _KEYREG: Registry values matrix (strings)
    _GROUP: name of group/category
    _KEY: name of item to Delete from values and key

detached(_GROUP, _KEY, _VALUE)
  detached make detached registry/val matrix
  Parameters:
    _GROUP: Name of first group
    _KEY: Name of first item
    _VALUE: Item of any type, sets the output type too.

tradingview.com/script/fyt5iGYQ-matrixautotable/

版本注释

v2
Some Speedups, dropped the add functions See "columns" and "rows" library for replacements (better!)

Removed:
addrow()

addcolumn()
评论
loxx
Posting the heavy lifting code I see, very good work.
avoidy
Great work, really usefull! Looks to complicated on first look, but if you'll give it a chance, you'll find it great tool to optimize how your code looks and how much time do you spend just to output all the data needed not covering all the screen with generic labels and tables (if you have similar problem, you should shurely try)
更多