NR_Versatilities

Versatilities (aka, Versatile Utilities) includes:
- Seventeen Price Variants returned as a tuple,
- Eight Smoothing functions rolled into one,
- Pick any Past Value from any series with offset,
- Or just the previous value from any series.
pastVal(src, len)
Fetches past value from src that came len distance ago
Parameters:
src (float): source series
len (int): lookback distance - (optional) default is 1
Returns: latest src if len <= 0, else src[len]
previous(src)
Fetches past value from src that came len distance ago
Parameters:
src (float): source series
Returns: previous value in the series if found, else current value
price_variants()
Computes Several different averages using current and previous OHLC values
Returns: Seventeen Uncommon Average Price Combinations
dynamic_MA(matyp, masrc, malen, lsmaoff, almasgm, almaoff, almaflr)
Dynamically computes Eight different MAs on-demand individually, or an average of all taken together
Parameters:
matyp (string): pick one of these MAs - ALMA, EMA, HMA, LSMA, RMA, SMA, SWMA, WMA, ALL [= average of all MAs]
masrc (float): source series to compute MA
malen (simple int): lookback distance for MA
lsmaoff (simple int): optional LSMA offset - default is 0
almasgm (simple float): optional ALMA sigma - default is 5
almaoff (simple float): optional ALMA offset - default is 0.5
almaflr (simple bool): optional ALMA floor flag - default is false
Returns: MA series for chosen type or, an average of all of them, if chosen so
Updated:
pastVal(src, len)
Fetches past value from src that came len distance ago
Parameters:
src (float): source series
len (int): lookback distance - (optional) default is 1
Returns: latest src if len <= 0, else src[len] (rounded-to-mintick)
price_variants()
Computes Several different averages using current and previous OHLC values
Returns: Map of Eighteen Uncommon Combinations of single and two-bar OHLC averages (rounded-to-mintick)
dynamic_MA(matyp, masrc, malen, lsmaoff, almasgm, almaoff, almaflr)
Dynamically computes Eight different MAs on-demand individually, or an average of all taken together
Parameters:
matyp (string): pick one of these MAs - ALMA, EMA, HMA, LSMA, RMA, SMA, SWMA, WMA, ALL [= average of all MAs]
masrc (float): source series to compute MA
malen (simple int): lookback distance for MA
lsmaoff (simple int): optional LSMA offset - default is 0
almasgm (simple float): optional ALMA sigma - default is 5
almaoff (simple float): optional ALMA offset - default is 0.5
almaflr (simple bool): optional ALMA floor flag - default is false
Returns: MA series for chosen type or, an average of all of them, if chosen so (rounded-to-mintick)
Updated:
dynamic_MA(masrc, malen, lsmaoff, almasgm, almaoff, almaflr)
Dynamically computes Eight different MAs and returns a Map containing Nine MAs
Parameters:
masrc (float): source series to compute MA
malen (simple int): lookback distance for MA
lsmaoff (simple int): optional LSMA offset - default is 0
almasgm (simple float): optional ALMA sigma - default is 5
almaoff (simple float): optional ALMA offset - default is 0.5
almaflr (simple bool): optional ALMA floor flag - default is false
Returns: Map of MAs - 'ALMA', 'EMA', 'HMA', 'LSMA', 'RMA', 'SMA', 'SWMA', 'WMA', 'ALL' (rounded-to-mintick)
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.