using matrixes, and overloads.. a complete parallel multiregistry, multitype,multikey datastore.
it can use get, set, delete, with as many registries and individual matrixes as the system can handle.
system >
registry
category names
key names for each item
value (( to x/y in value matrix)
value matrix
item in x/y coords
so putting item 'float XXX' with a value of XXX (ohlc..) for category 'ohlc values' into value matrix floats, floats1 for hist... etc.. historical value for the past X num of bars for all 4 values in historical matrixes..
here's an example..
almost done testing..
very powerful tool
anyone with extensive skills who can take a look at it, i'm open for help prepping and finding any optimizations available
as is, it is very very fast..
i believe i can improve though from here.
Pine Script®
_ohlcreg = initkeyregistry(2,2)
_regfloats = ini_float(2,2)
_hist1_floats = ini_float(2,2)
_colorreg = ini_color(2,2)
set(_regfloats , _ohlcreg, 'Normal', 'open ' , open )
set(_regfloats , _ohlcreg, 'Normal', 'high ' , high )
set(_regfloats , _ohlcreg, 'Normal', 'low ' , low )
set(_regfloats , _ohlcreg, 'Normal', 'close ' , close )
set(_regfloats , _ohlcreg, 'MTF' , 'open ' , request.security('MSFT', 'D', open ))
set(_regfloats , _ohlcreg, 'MTF' , 'high ' , request.security('MSFT', 'D', high ))
set(_regfloats , _ohlcreg, 'MTF' , 'low ' , request.security('MSFT', 'D', low ))
set(_regfloats , _ohlcreg, 'MTF' , 'close ' , request.security('MSFT', 'D', close ))
set(_hist1_floats, _ohlcreg, 'Normal', 'open ' , open [1])
set(_hist1_floats, _ohlcreg, 'Normal', 'high ' , high [1])
set(_hist1_floats, _ohlcreg, 'Normal', 'low ' , low [1])
set(_hist1_floats, _ohlcreg, 'Normal', 'close ' , close [1])
set(_hist1_floats, _ohlcreg, 'MTF' , 'open ' , request.security('MSFT', 'D', open [1] ))
set(_hist1_floats, _ohlcreg, 'MTF' , 'high ' , request.security('MSFT', 'D', high [1] ))
set(_hist1_floats, _ohlcreg, 'MTF' , 'low ' , request.security('MSFT', 'D', low [1] ))
set(_hist1_floats, _ohlcreg, 'MTF' , 'close ' , request.security('MSFT', 'D', close[1] ))
// add colors for these specific ones.. if a value is attempted to retrieve
// but the spot on the value matrix is empty, it will siimple pull a typecast na.
// so these colors show when specidfied.. will have to make a global or a '*' for any'
set(_colorreg , _ohlcreg, 'Normal', 'open ' , color.red )
set(_colorreg , _ohlcreg, 'Normal', 'high ' , color.green )
set(_colorreg , _ohlcreg, 'Normal', 'low ' , color.blue )
set(_colorreg , _ohlcreg, 'Normal', 'close ' , color.orange)
// ... etc..
// the retrieval now can select along any axis...
// which matrix to use
valmatrix = switch input(0)
0 => _regfloats
1 => _hist1_floats
/// which group to pull from
_barchoice = input.string('MTF', options = ['Normal','MTF'])
/// which value from that group-.
valuechoice = switch input(1)
1 => 'open '
2 => 'high '
3 => 'low '
4 => 'close '
plot(get(valmatrix, _ohlcreg, _barchoice, valuechoice ))
plot(get(_regfloats , _ohlcreg, 'Normal', 'open '), 'Normal open ' ,
get(_colorreg , _ohlcreg, 'Normal', 'open '))
plot(get(_regfloats , _ohlcreg, 'Normal', 'high '), 'Normal high ' ,
get(_colorreg , _ohlcreg, 'Normal', 'high '))
plot(get(_regfloats , _ohlcreg, 'Normal', 'low '), 'Normal low ' ,
get(_colorreg , _ohlcreg, 'Normal', 'low '))
plot(get(_regfloats , _ohlcreg, 'Normal', 'close '), 'Normal close ' ,
get(_colorreg , _ohlcreg, 'Normal', 'close '))
_regfloats = ini_float(2,2)
_hist1_floats = ini_float(2,2)
_colorreg = ini_color(2,2)
set(_regfloats , _ohlcreg, 'Normal', 'open ' , open )
set(_regfloats , _ohlcreg, 'Normal', 'high ' , high )
set(_regfloats , _ohlcreg, 'Normal', 'low ' , low )
set(_regfloats , _ohlcreg, 'Normal', 'close ' , close )
set(_regfloats , _ohlcreg, 'MTF' , 'open ' , request.security('MSFT', 'D', open ))
set(_regfloats , _ohlcreg, 'MTF' , 'high ' , request.security('MSFT', 'D', high ))
set(_regfloats , _ohlcreg, 'MTF' , 'low ' , request.security('MSFT', 'D', low ))
set(_regfloats , _ohlcreg, 'MTF' , 'close ' , request.security('MSFT', 'D', close ))
set(_hist1_floats, _ohlcreg, 'Normal', 'open ' , open [1])
set(_hist1_floats, _ohlcreg, 'Normal', 'high ' , high [1])
set(_hist1_floats, _ohlcreg, 'Normal', 'low ' , low [1])
set(_hist1_floats, _ohlcreg, 'Normal', 'close ' , close [1])
set(_hist1_floats, _ohlcreg, 'MTF' , 'open ' , request.security('MSFT', 'D', open [1] ))
set(_hist1_floats, _ohlcreg, 'MTF' , 'high ' , request.security('MSFT', 'D', high [1] ))
set(_hist1_floats, _ohlcreg, 'MTF' , 'low ' , request.security('MSFT', 'D', low [1] ))
set(_hist1_floats, _ohlcreg, 'MTF' , 'close ' , request.security('MSFT', 'D', close[1] ))
// add colors for these specific ones.. if a value is attempted to retrieve
// but the spot on the value matrix is empty, it will siimple pull a typecast na.
// so these colors show when specidfied.. will have to make a global or a '*' for any'
set(_colorreg , _ohlcreg, 'Normal', 'open ' , color.red )
set(_colorreg , _ohlcreg, 'Normal', 'high ' , color.green )
set(_colorreg , _ohlcreg, 'Normal', 'low ' , color.blue )
set(_colorreg , _ohlcreg, 'Normal', 'close ' , color.orange)
// ... etc..
// the retrieval now can select along any axis...
// which matrix to use
valmatrix = switch input(0)
0 => _regfloats
1 => _hist1_floats
/// which group to pull from
_barchoice = input.string('MTF', options = ['Normal','MTF'])
/// which value from that group-.
valuechoice = switch input(1)
1 => 'open '
2 => 'high '
3 => 'low '
4 => 'close '
plot(get(valmatrix, _ohlcreg, _barchoice, valuechoice ))
plot(get(_regfloats , _ohlcreg, 'Normal', 'open '), 'Normal open ' ,
get(_colorreg , _ohlcreg, 'Normal', 'open '))
plot(get(_regfloats , _ohlcreg, 'Normal', 'high '), 'Normal high ' ,
get(_colorreg , _ohlcreg, 'Normal', 'high '))
plot(get(_regfloats , _ohlcreg, 'Normal', 'low '), 'Normal low ' ,
get(_colorreg , _ohlcreg, 'Normal', 'low '))
plot(get(_regfloats , _ohlcreg, 'Normal', 'close '), 'Normal close ' ,
get(_colorreg , _ohlcreg, 'Normal', 'close '))
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.