lib_momentumLibrary "lib_momentum"
This library calculates the momentum, derived from a sample range of prior candles. Depending on set MomentumType it either deduces the momentum from the price, volume, or a product of both. If price/product are selected, you can choose from SampleType if only candle body, full range from high to low or a combination of both (body counts full, wicks half for each direction) should be used. Optional: You can choose to normalize the results, dividing each value by its average (normalization_ma_length, normalization_ma). This will allow comparison between different instruments. For the normalization Moving Average you can choose any currently supported in my lib_no_delay.
get_momentum(momentum_type, sample_type, sample_length, normalization_ma_length, normalization_ma)
Parameters:
momentum_type (series MomentumType) : select one of MomentumType. to sample the price, volume or a product of both
sample_type (series SampleType) : select one of SampleType. to sample the body, total range from high to low or a combination of both (body count full, wicks half for each direction)
sample_length (simple int) : how many candles should be sampled (including the current)
normalization_ma_length (simple int) : if you want to normalize results (momentum / momentum average) this sets the period for the average. (default = 0 => no normalization)
normalization_ma (simple MovingAverage enum from robbatt/lib_no_delay/9) : is the type of moving average to normalize / compare with
Returns: returns the current momentum where the total line is not just (up - down) but also sampled over the sample_length and can therefore be used as trend indicator. If up/down fail to reach total's level it's a sign of decreasing momentum, if up/down exceed total the trend it's a sign of increasing momentum.
Techindicator
RawCuts_01Library "RawCuts_01"
A collection of functions by:
mutantdog
The majority of these are used within published projects, some useful variants have been included here aswell.
This is volume one consisting mainly of smaller functions, predominantly the filters and standard deviations from Weight Gain 4000.
Also included at the bottom are various snippets of related code for demonstration. These can be copied and adjusted according to your needs.
A full up-to-date table of contents is located at the top of the main script.
WEIGHT GAIN FILTERS
A collection of moving average type filters with adjustable volume weighting.
Based upon the two most common methods of volume weighting.
'Simple' uses the standard method in which a basic VWMA is analogous to SMA.
'Elastic' uses exponential method found in EVWMA which is analogous to RMA.
Volume weighting is applied according to an exponent multiplier of input volume.
0 >> volume^0 (unweighted), 1 >> volume^1 (fully weighted), use float values for intermediate weighting.
Additional volume filter switch for smoothing of outlier events.
DIVA MODULAR DEVIATIONS
A small collection of standard and absolute deviations.
Includes the weightgain functionality as above.
Basic modular functionality for more creative uses.
Optional input (ct) for external central tendency (aka: estimator).
Can be assigned to alternative filter or any float value. Will default to internal filter when no ct input is received.
Some other useful or related functions included at the bottom along with basic demonstration use.
weightgain_sma(src, len, xVol, fVol)
Simple Moving Average (SMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Standard Simple Moving Average with Simple Weight Gain applied.
weightgain_hsma(src, len, xVol, fVol)
Harmonic Simple Moving Average (hSMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Harmonic Simple Moving Average with Simple Weight Gain applied.
weightgain_gsma(src, len, xVol, fVol)
Geometric Simple Moving Average (gSMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Geometric Simple Moving Average with Simple Weight Gain applied.
weightgain_wma(src, len, xVol, fVol)
Linear Weighted Moving Average (WMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Basic Linear Weighted Moving Average with Simple Weight Gain applied.
weightgain_hma(src, len, xVol, fVol)
Hull Moving Average (HMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Basic Hull Moving Average with Simple Weight Gain applied.
diva_sd_sma(src, len, xVol, fVol, ct)
Standard Deviation (SD SMA): Diva / Weight Gain (Simple Volume)
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_sma().
Returns:
diva_sd_wma(src, len, xVol, fVol, ct)
Standard Deviation (SD WMA): Diva / Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_wma().
Returns:
diva_aad_sma(src, len, xVol, fVol, ct)
Average Absolute Deviation (AAD SMA): Diva / Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_sma().
Returns:
diva_aad_wma(src, len, xVol, fVol, ct)
Average Absolute Deviation (AAD WMA): Diva / Weight Gain (Simple Volume) .
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_wma().
Returns:
weightgain_ema(src, len, xVol, fVol)
Exponential Moving Average (EMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Exponential Moving Average with Elastic Weight Gain applied.
weightgain_dema(src, len, xVol, fVol)
Double Exponential Moving Average (DEMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Double Exponential Moving Average with Elastic Weight Gain applied.
weightgain_tema(src, len, xVol, fVol)
Triple Exponential Moving Average (TEMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Triple Exponential Moving Average with Elastic Weight Gain applied.
weightgain_rma(src, len, xVol, fVol)
Rolling Moving Average (RMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Rolling Moving Average with Elastic Weight Gain applied.
weightgain_drma(src, len, xVol, fVol)
Double Rolling Moving Average (DRMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Double Rolling Moving Average with Elastic Weight Gain applied.
weightgain_trma(src, len, xVol, fVol)
Triple Rolling Moving Average (TRMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Triple Rolling Moving Average with Elastic Weight Gain applied.
diva_sd_ema(src, len, xVol, fVol, ct)
Standard Deviation (SD EMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_ema().
Returns:
diva_sd_rma(src, len, xVol, fVol, ct)
Standard Deviation (SD RMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_rma().
Returns:
weightgain_vidya_rma(src, len, xVol, fVol)
VIDYA v1 RMA base (VIDYA-RMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: VIDYA v1, RMA base with Elastic Weight Gain applied.
weightgain_vidya_ema(src, len, xVol, fVol)
VIDYA v1 EMA base (VIDYA-EMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: VIDYA v1, EMA base with Elastic Weight Gain applied.
diva_sd_vidya_rma(src, len, xVol, fVol, ct)
Standard Deviation (SD VIDYA-RMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_vidya_rma().
Returns:
diva_sd_vidya_ema(src, len, xVol, fVol, ct)
Standard Deviation (SD VIDYA-EMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_vidya_ema().
Returns:
weightgain_sema(src, len, xVol, fVol)
Parameters:
src (float)
len (simple int)
xVol (float)
fVol (bool)
diva_sd_sema(src, len, xVol, fVol)
Parameters:
src (float)
len (simple int)
xVol (float)
fVol (bool)
diva_mad_mm(src, len, ct)
Median Absolute Deviation (MAD MM): Diva (no volume weighting).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
ct (float) : Central tendency (optional, na = bypass). Internal: ta.median()
Returns:
source_switch(slct, aux1, aux2, aux3, aux4)
Custom Source Selector/Switch function. Features standard & custom 'weighted' sources with additional aux inputs.
Parameters:
slct (string) : Choose from custom set of string values.
aux1 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
aux2 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
aux3 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
aux4 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
Returns: Float value, to be used as src input for other functions.
colour_gradient_ma_div(ma1, ma2, div, bull, bear, mid, mult)
Colour Gradient for plot fill between two moving averages etc, with seperate bull/bear and divergence strength.
Parameters:
ma1 (float) : Input for fast moving average (eg: bullish when above ma2).
ma2 (float) : Input for slow moving average (eg: bullish when below ma1).
div (float) : Input deviation/divergence value used to calculate strength of colour.
bull (color) : Colour when ma1 above ma2.
bear (color) : Colour when ma1 below ma2.
mid (color) : Neutral colour when ma1 = ma2.
mult (int) : Opacity multiplier. 100 = maximum, 0 = transparent.
Returns: Colour with transparency (according to specified inputs)
CandlestickPatternsLibrary "CandlestickPatterns"
zigzag(_low, _high, depth, deviation, backstep)
Parameters:
_low (float)
_high (float)
depth (int)
deviation (int)
backstep (int)
getTrend(trendType, currentClose, zz_downtrend, zz_uptrend, ema14, ema28)
Parameters:
trendType (string)
currentClose (float)
zz_downtrend (bool)
zz_uptrend (bool)
ema14 (float)
ema28 (float)
isInside(currentHigh, currentLow, currentClose, currentOpen, prevHigh, prevLow)
Parameters:
currentHigh (float)
currentLow (float)
currentClose (float)
currentOpen (float)
prevHigh (float)
prevLow (float)
checkMorningStar(open0, high0, low0, close0, open1, high1, low1, close1, open2, high2, low2, close2, innerCandleThreshold, closingMinThreshold, closingMaxThreshold, useDojiFilter, dojiSize, downTrend)
Parameters:
open0 (float)
high0 (float)
low0 (float)
close0 (float)
open1 (float)
high1 (float)
low1 (float)
close1 (float)
open2 (float)
high2 (float)
low2 (float)
close2 (float)
innerCandleThreshold (float)
closingMinThreshold (float)
closingMaxThreshold (float)
useDojiFilter (bool)
dojiSize (float)
downTrend (bool)
checkEveningStar(open0, high0, low0, close0, open1, high1, low1, close1, open2, high2, low2, close2, innerCandleThreshold, closingMinThreshold, closingMaxThreshold, useDojiFilter, dojiSize, upTrend)
Parameters:
open0 (float)
high0 (float)
low0 (float)
close0 (float)
open1 (float)
high1 (float)
low1 (float)
close1 (float)
open2 (float)
high2 (float)
low2 (float)
close2 (float)
innerCandleThreshold (float)
closingMinThreshold (float)
closingMaxThreshold (float)
useDojiFilter (bool)
dojiSize (float)
upTrend (bool)
checkHammerPattern(open, high, low, close, bodyAvg, shadowFactor, downTrend)
Parameters:
open (float)
high (float)
low (float)
close (float)
bodyAvg (float)
shadowFactor (float)
downTrend (bool)
checkInvertedHammerPattern(open, high, low, close, bodyAvg, shadowFactor, downTrend)
Parameters:
open (float)
high (float)
low (float)
close (float)
bodyAvg (float)
shadowFactor (float)
downTrend (bool)
checkHangingManPattern(open, high, low, close, bodyAvg, shadowFactor, upTrend)
Parameters:
open (float)
high (float)
low (float)
close (float)
bodyAvg (float)
shadowFactor (float)
upTrend (bool)
checkShootingStarPattern(open, high, low, close, bodyAvg, shadowFactor, upTrend)
Parameters:
open (float)
high (float)
low (float)
close (float)
bodyAvg (float)
shadowFactor (float)
upTrend (bool)
checkLevels(high0, high1, high2, low0, low1, low2, lookbackPeriod)
Parameters:
high0 (float)
high1 (float)
high2 (float)
low0 (float)
low1 (float)
low2 (float)
lookbackPeriod (int)
HTFBands█ OVERVIEW
Contains type and methods for drawing higher-timeframe bands of several types:
Bollinger bands
Parabolic SAR
Supertrend
VWAP
By copy pasting ready made code sections to your script you can add as many multi-timeframe bands as necessary.
█ HOW TO USE
Please see instructions in the code. (Important: first fold all sections of the script: press Cmd + K then Cmd + - (for Windows Ctrl + K then Ctrl + -)
█ FULL LIST OF FUNCTIONS AND PARAMETERS
atr2(length)
An alternate ATR function to the `ta.atr()` built-in, which allows a "series float"
`length` argument.
Parameters:
length (float) : (series int/float) Length for the smoothing parameter calculation.
Returns: (float) The ATR value.
pine_supertrend2(factor, atrLength, wicks)
An alternate SuperTrend function to `supertrend()`, which allows a "series float"
`atrLength` argument.
Parameters:
factor (float) : (series int/float) Multiplier for the ATR value.
atrLength (float) : (series int/float) Length for the ATR smoothing parameter calculation.
wicks (simple bool) : (simple bool) Condition to determine whether to take candle wicks into account when
reversing trend, or to use the close price. Optional. Default is false.
Returns: ( ) A tuple of the superTrend value and trend direction.
method getDefaultBandQ1(bandType)
For a given BandType returns its default Q1
Namespace types: series BandTypes
Parameters:
bandType (series BandTypes)
method getDefaultBandQ2(bandType)
For a given BandType returns its default Q2
Namespace types: series BandTypes
Parameters:
bandType (series BandTypes)
method getDefaultBandQ3(bandType)
For a given BandType returns its default Q3
Namespace types: series BandTypes
Parameters:
bandType (series BandTypes)
method init(this, bandsType, q1, q2, q3, vwapAnchor)
Initiates RsParamsBands for each band (used in htfUpdate() withi req.sec())
Namespace types: RsParamsBands
Parameters:
this (RsParamsBands)
bandsType (series BandTypes)
q1 (float) : (float) Depending on type: BB - length, SAR - AF start, ST - ATR's prd
q2 (float) : (float) Depending on type: BB - StdDev mult, SAR - AF step, ST - mult
q3 (float) : (float) Depending on type: BB - not used, SAR - AF max, ST - not used
vwapAnchor (series VwapAnchors) : (VwapAnchors) VWAP ahcnor
method init(this, bandsType, tf, showRecentBars, lblsShow, lblsMaxLabels, lblSize, lnMidClr, lnUpClr, lnLoClr, fill, fillClr, lnWidth, lnSmoothen)
Initialises object with params (incl. input). Creates arrays if any.
Namespace types: HtfBands
Parameters:
this (HtfBands)
bandsType (series BandTypes) : (BandTypes) Just used to enable/disable - if BandTypes.none then disable )
tf (string) : (string) Timeframe
showRecentBars (int) : (int) Only show over this number of recent bars
lblsShow (bool) : (bool) Show labels
lblsMaxLabels (int) : (int) Max labels to show
lblSize (string) : (string) Size of the labels
lnMidClr (color) : (color) Middle band color
lnUpClr (color) : (color) Upper band color
lnLoClr (color) : (color) Lower band color
fill (bool)
fillClr (color) : (color) Fill color
lnWidth (int) : (int) Line width
lnSmoothen (bool) : (bool) Smoothen the bands
method htfUpdateTuple(rsPrms, repaint)
(HTF) Calculates Bands within request.security(). Returns tuple . If any or all of the bands are not available returns na as their value.
Namespace types: RsParamsBands
Parameters:
rsPrms (RsParamsBands) : (RsParamsBands) Parameters of the band.
repaint (bool) : (bool) If true does not update on realtime bars.
Returns: A tuple (corresponds to fields in RsReturnBands)
method importRsRetTuple(this, htfBi, mid, up, lo, dir)
Imports a tuple returned from req.sec() into an HtfBands object
Namespace types: HtfBands
Parameters:
this (HtfBands) : (HtfBands) Object to import to
htfBi (int) : (float) Higher timeframe's bar index (Default = na)
mid (float)
up (float) : (float) Value of upper band (Default = na)
lo (float) : (float) Value of lower band (Default = na)
dir (int) : (int) Direction (for bands like Parabolic SAR) (Default = na)
method addUpdDrawings(this, rsPrms)
Draws band's labels
Namespace types: HtfBands
Parameters:
this (HtfBands)
rsPrms (RsParamsBands)
method update(this)
Sets band's values to na on intrabars if `smoothen` is set.
Namespace types: HtfBands
Parameters:
this (HtfBands)
method newRsParamsBands(this)
A wraper for RsParamsBands.new()
Namespace types: LO_A
Parameters:
this (LO_A)
method newHtfBands(this)
A wraper for HtfBands.new()
Namespace types: LO_B
Parameters:
this (LO_B)
RsParamsBands
Used to pass bands' params to req.sec()
Fields:
bandsType (series BandTypes) : (enum BandTypes) Type of the band (BB, SAR etc.)
q1 (series float) : (float) Depending on type: BB - length, SAR - AF start, ST - ATR's prd
q2 (series float) : (float) Depending on type: BB - StdDev mult, SAR - AF step, ST - mult
q3 (series float) : (float) Depending on type: BB - not used, SAR - AF max, ST - not used
vwapAnchor (series VwapAnchors)
RsReturnBands
Used to return bands' data from req.sec(). Params of the bands are in RsParamsBands
Fields:
htfBi (series float) : (float) Higher timeframe's bar index (Default = na)
upBand (series float) : (float) Value of upper band (Default = na)
loBand (series float) : (float) Value of lower band (Default = na)
midBand (series float) : (float) Value of middle band (Default = na)
dir (series int) : (float) Direction (for bands like Parabolic SAR) (Default = na)
BandsDrawing
Contains plot visualization parameters and stores and keeps track of lines, labels and other visual objects (not plots)
Fields:
lnMidClr (series color) : (color) Middle band color
lnLoClr (series color) : (color) Lower band color
lnUpClr (series color) : (color) Upper band color
fillUpClr (series color)
fillLoClr (series color)
lnWidth (series int) : (int) Line width
lnSmoothen (series bool) : (bool) Smoothen the bands
showHistory (series bool) : (bool) If true show bands lines, otherwise only current level
showRecentBars (series int) : (int) Only show over this number of recent bars
arLbl (array) : (label Labels
lblsMaxLabels (series int) : (int) Max labels to show
lblsShow (series bool) : (bool) Show labels
lblSize (series string) : (string) Size of the labels
HtfBands
Calcs and draws HTF bands
Fields:
rsRet (RsReturnBands) : (RsReturnBands) Bands' values
rsRetNaObj (RsReturnBands) : (RsReturnBands) Dummy na obj for returning from request.security()
rsPrms (RsParamsBands) : (RsParamsBands) Band parameters (for htfUpdate() called in req.sec() )
drw (BandsDrawing) : (BandsDrawing) Contains plot visualization parameters and stores and keeps track of lines, labels and other visual objects (not plots)
enabled (series bool) : (bool) Toggles bands on/off
tf (series string) : (string) Timeframe
LO_A
LO Library object, whose only purpose is to serve as a shorthand for library name in script code.
Fields:
dummy (series string)
LO_B
LO Library object, whose only purpose is to serve as a shorthand for library name in script code.
Fields:
dummy (series string)
HTFMAs█ OVERVIEW
Contains a type HTFMA used to return data on six moving averages from a higher timeframe.
Several types of MA's are supported.
█ HOW TO USE
Please see instructions in the code (in library description). (Important: first fold all sections of the script: press Cmd + K then Cmd + - (for Windows Ctrl + K then Ctrl + -)
█ FULL LIST OF FUNCTIONS AND PARAMETERS
method getMaType(this)
Enumerator function, given a key returns `enum MaTypes` value
Namespace types: series string, simple string, input string, const string
Parameters:
this (string)
method init(this, enableAll, ma1Enabled, ma1MaType, ma1Src, ma1Prd, ma2Enabled, ma2MaType, ma2Src, ma2Prd, ma3Enabled, ma3MaType, ma3Src, ma3Prd, ma4Enabled, ma4MaType, ma4Src, ma4Prd, ma5Enabled, ma5MaType, ma5Src, ma5Prd, ma6Enabled, ma6MaType, ma6Src, ma6Prd)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs)
enableAll (simple MaEnable)
ma1Enabled (bool)
ma1MaType (series MaTypes)
ma1Src (string)
ma1Prd (int)
ma2Enabled (bool)
ma2MaType (series MaTypes)
ma2Src (string)
ma2Prd (int)
ma3Enabled (bool)
ma3MaType (series MaTypes)
ma3Src (string)
ma3Prd (int)
ma4Enabled (bool)
ma4MaType (series MaTypes)
ma4Src (string)
ma4Prd (int)
ma5Enabled (bool)
ma5MaType (series MaTypes)
ma5Src (string)
ma5Prd (int)
ma6Enabled (bool)
ma6MaType (series MaTypes)
ma6Src (string)
ma6Prd (int)
method init(this, enableAll, tf, rngAtrQ, showRecentBars, lblsOffset, lblsShow, lnOffset, lblSize, lblStyle, smoothen, ma1lnClr, ma1lnWidth, ma1lnStyle, ma2lnClr, ma2lnWidth, ma2lnStyle, ma3lnClr, ma3lnWidth, ma3lnStyle, ma4lnClr, ma4lnWidth, ma4lnStyle, ma5lnClr, ma5lnWidth, ma5lnStyle, ma6lnClr, ma6lnWidth, ma6lnStyle, ma1ShowHistory, ma2ShowHistory, ma3ShowHistory, ma4ShowHistory, ma5ShowHistory, ma6ShowHistory, ma1ShowLabel, ma2ShowLabel, ma3ShowLabel, ma4ShowLabel, ma5ShowLabel, ma6ShowLabel)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
enableAll (series MaEnable)
tf (string)
rngAtrQ (int)
showRecentBars (int)
lblsOffset (int)
lblsShow (bool)
lnOffset (int)
lblSize (string)
lblStyle (string)
smoothen (bool)
ma1lnClr (color)
ma1lnWidth (int)
ma1lnStyle (string)
ma2lnClr (color)
ma2lnWidth (int)
ma2lnStyle (string)
ma3lnClr (color)
ma3lnWidth (int)
ma3lnStyle (string)
ma4lnClr (color)
ma4lnWidth (int)
ma4lnStyle (string)
ma5lnClr (color)
ma5lnWidth (int)
ma5lnStyle (string)
ma6lnClr (color)
ma6lnWidth (int)
ma6lnStyle (string)
ma1ShowHistory (bool)
ma2ShowHistory (bool)
ma3ShowHistory (bool)
ma4ShowHistory (bool)
ma5ShowHistory (bool)
ma6ShowHistory (bool)
ma1ShowLabel (bool)
ma2ShowLabel (bool)
ma3ShowLabel (bool)
ma4ShowLabel (bool)
ma5ShowLabel (bool)
ma6ShowLabel (bool)
method get(this, id)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs)
id (int)
method set(this, id, prop, val)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs)
id (int)
prop (string)
val (string)
method set(this, id, prop, val)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
id (int)
prop (string)
val (string)
method htfUpdateTuple(rsParams, repaint)
Namespace types: RsParamsMAs
Parameters:
rsParams (RsParamsMAs)
repaint (bool)
method clear(this)
Namespace types: MaDrawing
Parameters:
this (MaDrawing)
method importRsRetTuple(this, htfBi, ma1, ma2, ma3, ma4, ma5, ma6)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
htfBi (int)
ma1 (float)
ma2 (float)
ma3 (float)
ma4 (float)
ma5 (float)
ma6 (float)
method getDrw(this, id)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
id (int)
method setDrwProp(this, id, prop, val)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
id (int)
prop (string)
val (string)
method initDrawings(this, rsPrms, dispBandWidth)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
rsPrms (RsParamsMAs)
dispBandWidth (float)
method updateDrawings(this, rsPrms, dispBandWidth)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
rsPrms (RsParamsMAs)
dispBandWidth (float)
method update(this)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps0 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps1 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps2 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps3 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps4 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps5 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `RsParamsMAs` child `RsMaCalcParams` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (RsParamsMAs) Target object to import prop values to.
oCfg (objProps6 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs)
oCfg (objProps7 type from moebius1977/CSVParser/1)
maCount (int)
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: RsParamsMAs
Parameters:
this (RsParamsMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps8 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps0 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps1 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps2 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps3 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps4 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps5 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Imports HTF MAs settings from objProps (of any level) into `HTFMAs` child `MaDrawing` objects (into the first first `maCount` of them)
Namespace types: HTFMAs
Parameters:
this (HTFMAs) : (HTFMAs) Target object to import prop values to.
oCfg (objProps6 type from moebius1977/CSVParser/1) : (CSVP.objProps) (one of objProps types) an objProps, ... opjProps8 containing properties' values in a child objProps objects
maCount (int) : (int) Number of tgtObj's RsMaCalcParams childs of tgtObj to set (1 to 6, starting from 1)
Returns: this
method importConfig(this, oCfg, maCount)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
oCfg (objProps7 type from moebius1977/CSVParser/1)
maCount (int)
method importConfig(this, oCfg, maCount)
Namespace types: HTFMAs
Parameters:
this (HTFMAs)
oCfg (objProps8 type from moebius1977/CSVParser/1)
maCount (int)
method newRsParamsMAs(this)
Namespace types: LO
Parameters:
this (LO)
method newHTFMAs(this)
Namespace types: LO
Parameters:
this (LO)
RsMaCalcParams
Parameters of one MA (only calculation params needed within req.sec(), visual parameters are within htfMAs type)
Fields:
enabled (series bool)
maType (series MaTypes) : MA type options: SMA / EMA / WMA / ...
src (series string)
prd (series int) : MA period
RsParamsMAs
Collection of parameters of 6 MAs. Used to pass params to req.sec()
Fields:
ma1CalcParams (RsMaCalcParams)
ma2CalcParams (RsMaCalcParams)
ma3CalcParams (RsMaCalcParams)
ma4CalcParams (RsMaCalcParams)
ma5CalcParams (RsMaCalcParams)
ma6CalcParams (RsMaCalcParams)
RsReturnMAs
Used to return data from req.sec().
Fields:
htfBi (series int)
ma1 (series float)
ma2 (series float)
ma3 (series float)
ma4 (series float)
ma5 (series float)
ma6 (series float)
MaDrawing
MA's plot parameters plus drawing objects for MA's current level (line and label).
Fields:
lnClr (series color) : (color) MA plot line color (like in plot())
lnWidth (series int) : (int) MA plot line width (like in plot())
lnStyle (series string) : (string) MA plot line style (like in plot())
showHistory (series bool) : (bool) Whether to plot the MA on historical bars or only show current level to the right of the latest bar.
showLabel (series bool) : (bool) Whether to show the name of the MA to the right of the MA's level
ln (series line) : (line) line to show MA"s current level
lbl (series label) : (label) label showing MA's name
HTFMAs
Contains data and drawing parameters for MA's of one timeframe (MA calculation parameters for MA's of one timeframe are in a separate object RsParamsMAs)
Fields:
rsRet (RsReturnMAs) : (RsReturnMAs) Contains data returned from req.sec(). Is set to na in between HTF bar changes if smoothing is enabled.
rsRetLast (RsReturnMAs) : (RsReturnMAs) Contains a copy of data returned from req.sec() in case rsRet is set to na for smoothing.
rsRetNaObj (RsReturnMAs) : (RsReturnMAs) An empty object as `na` placeholder
ma1Drawing (MaDrawing) : (MaDrawing) MA drawing properties
ma2Drawing (MaDrawing) : (MaDrawing) MA drawing properties
ma3Drawing (MaDrawing) : (MaDrawing) MA drawing properties
ma4Drawing (MaDrawing) : (MaDrawing) MA drawing properties
ma5Drawing (MaDrawing) : (MaDrawing) MA drawing properties
ma6Drawing (MaDrawing) : (MaDrawing) MA drawing properties
enabled (series bool) : (bool ) Enables/disables all of the MAs of one timeframe.
tf (series string) : (string) Timeframe
showHistory (series bool) : (bool ) Plot MA line on historical bars
rngAtrQ (series int) : (int ) A multiplier for atr(14). Determines a range within which the MA's will be plotted. MA's too far away will not be plotted.
showRecentBars (series int) : (int ) Only plot MA on these recent bars
smoothen (series bool) : (bool ) Smoothen MA plot. If false the same HTF value is returned on all chart bars within a HTF bar (intrabars), so the plot looks like steps.
lblsOffset (series int) : (int ) Show MA name this number of bars to the right off last bar.
lblsShow (series bool) : (bool ) Show MA name
lnOffset (series int) : (int ) Start line showing current level of the MA this number of bars to the right off the last bar.
lblSize (series string) : (string) Label size
lblStyle (series string) : (string) Label style
lblTxtAlign (series string) : (string) Label text align
bPopupLabel (series bool) : (bool ) Show current MA value as a tooltip to MA's name.
LO
LO Library object, whose only purpose is to serve as a shorthand for library name in script code.
Fields:
dummy (series string)
movingAveragesUtilitiesLibrary "movingAveragesUtilities"
get_movingAverages_data(source, length_fast, length_medium, length_slow)
Parameters:
source (float)
length_fast (simple int)
length_medium (simple int)
length_slow (simple int)
gridUtilitiesLibrary "gridUtilities"
TODO: add library description here
get_fibonacciGrid_data(length, trend_direction, plot_grid, plot_labels, bars_to_right, include_levels)
: Gets and plots a fibonacci grid.
Parameters:
length (int) : (int): The direction flag that indicates where the trend is going.
trend_direction (string) : (string): Direction of the trend (Long, Short or Neutral)
plot_grid (bool) : (bool): Plots the fibonacci grid.
plot_labels (bool) : (bool): Plots the datatable.
bars_to_right (int) : (bool): Plots the datatable.
include_levels (bool) : (bool): Plots the datatable.
Returns: : Returns a map with the grid levels, as string with the direction of the grid and a map with the values for the dataTable.
volumeUtilitiesLibrary "volumeUtilities"
generate_and_plot_volumeProfile(length, valueArea_perc, plot_vp, show_vp_labels, include_vp_levels)
: Generate and plot volume profile
Parameters:
length (int) : (int): Length of the volume profile indicator
valueArea_perc (float) : (float): Percentage of the volume that will be in the value area
plot_vp (bool) : (bool): Flag to plot or not the indicator
show_vp_labels (bool) : (bool): Flag to plot the labels of the levels
include_vp_levels (bool) : (bool): Flag to include the values inside the labels of the levels
Returns: : Returns POC level, upper value area level, lower value area level and alerts if close is above or below the value area.
bollingerBandsLibrary "bollingerBands"
Bollinger bands related functions
get_multiple_bollinger_bands(stdv1, stdv2, stdv3, stdv4, stdv5, stdv6, stdv7, length, source)
Parameters:
stdv1 (int)
stdv2 (int)
stdv3 (int)
stdv4 (int)
stdv5 (int)
stdv6 (int)
stdv7 (int)
length (simple int)
source (float)
get_bb_volatility(bb_highest, bb_lowest, ma_length, lookback)
Parameters:
bb_highest (float)
bb_lowest (float)
ma_length (simple int)
lookback (int)
pseudorenko█ CALCULATE PSEUDO-RENKO VALUE
Calculates and returns the Pseudo-Renko Stabilized value (or close price) based on a given input value, along with the direction of the current Renko brick. This function adapts the traditional Renko brick size dynamically based on the volatility of the input value using a combination of SMA and EMA calculations. The calculated price represents the closing price of the most recent Pseudo-Renko brick, while the direction indicates the trend ( 1 for uptrend, -1 for downtrend).
Parameters:
* `val` :
* Type: ` float `
* Description: The input value upon which the Pseudo-Renko calculations are performed. You can use any price series or custom value as input.
* `sensitivity` :
* Type: ` float `
* Default Value: ` 1.0 `
* Description: Controls the sensitivity of the brick size to the volatility of the `val`. Higher values lead to larger bricks, resulting in a smoother Renko chart. Lower values produce smaller bricks, leading to a more reactive chart.
* Possible Values: Any positive float.
* `length` :
* Type: ` int `
* Default Value: ` 7 `
* Description: The length used for calculating the EMA and SMA in the dynamic brick size calculation. It influences how quickly the brick size adapts to changing volatility of the `val`.
* Possible Values: Any positive integer.
Return Values:
* `lastRenkoClose` :
* Type: ` float `
* Description: The closing price of the last completed Pseudo-Renko brick based on the `val`.
* `renkoDirection` :
* Type: ` int `
* Description: The direction of the current Pseudo-Renko brick based on the `val`:
* ` 1 `: Uptrend
* ` -1 `: Downtrend
* ` 0 `: No change (initially, or no brick change since the previous bar)
Example Usage:
//@version=5
indicator("Pseudo-Renko Stabilized (Val)", overlay=true)
// Get user inputs
sensitivityInput = input.float(0.1, "Sensitivity",0.01,step=0.01)
lengthInput = input.int(5, "Length",2)
// Example usage with the 'close' price as the input value
= pseudo_renko(math.avg(close,open), sensitivityInput, lengthInput)
// Plot the Renko close price
plot(renkoClose, "Renko Close", renkoDirection>0?color.aqua:color.orange,2)
// You can also use other values as input, such as:
// = pseudo_renko(high, sensitivityInput, lengthInput)
// = pseudo_renko(low, sensitivityInput, lengthInput)
This example demonstrates how to use the `pseudo_renko` function within an indicator. It takes user inputs for `sensitivity` and `length`, then calculates the Pseudo-Renko values using the average of the `close` and `open` prices as the `val`. The resulting `renkoClose` price is plotted on the chart, with a color change based on the `renkoDirection`. It also illustrates how you can use other values, like `high` and `low`, as input to the function.
Note: The Pseudo-Renko algorithm is based on adapting the Renko brick size dynamically based on the input `val`. This provides more flexibility compared to the normal, but is experimental. The `sensitivity` and `length` parameters, along with the choice of the `val`, offer further customization to tune the algorithm's behavior to your preference and trading style.
[ALGOA+] Markov Chains Library by @metacamaleoLibrary "MarkovChains"
Markov Chains library by @metacamaleo. Created in 09/08/2024.
This library provides tools to calculate and visualize Markov Chain-based transition matrices and probabilities. This library supports two primary algorithms: a rolling window Markov Chain and a conditional Markov Chain (which operates based on specified conditions). The key concepts used include Markov Chain states, transition matrices, and future state probabilities based on past market conditions or indicators.
Key functions:
- `mc_rw()`: Builds a transition matrix using a rolling window Markov Chain, calculating probabilities based on a fixed length of historical data.
- `mc_cond()`: Builds a conditional Markov Chain transition matrix, calculating probabilities based on the current market condition or indicator state.
Basically, you will just need to use the above functions on your script to default outputs and displays.
Exported UDTs include:
- s_map: An UDT variable used to store a map with dummy states, i.e., if possible states are bullish, bearish, and neutral, and current is bullish, it will be stored
in a map with following keys and values: "bullish", 1; "bearish", 0; and "neutral", 0. You will only use it to customize your own script, otherwise, it´s only for internal use.
- mc_states: This UDT variable stores user inputs, calculations and MC outputs. As the above, you don´t need to use it, but you may get features to customize your own script.
For example, you may use mc.tm to get the transition matrix, or the prob map to customize the display. As you see, functions are all based on mc_states UDT. The s_map UDT is used within mc_states´s s array.
Optional exported functions include:
- `mc_table()`: Displays the transition matrix in a table format on the chart for easy visualization of the probabilities.
- `display_list()`: Displays a map (or array) of string and float/int values in a table format, used for showing transition counts or probabilities.
- `mc_prob()`: Calculates and displays probabilities for a given number of future bars based on the current state in the Markov Chain.
- `mc_all_states_prob()`: Calculates probabilities for all states for future bars, considering all possible transitions.
The above functions may be used to customize your outputs. Use the returned variable mc_states from mc_rw() and mc_cond() to display each of its matrix, maps or arrays using mc_table() (for matrices) and display_list() (for maps and arrays) if you desire to debug or track the calculation process.
See the examples in the end of this script.
Have good trading days!
Best regards,
@metacamaleo
-----------------------------
KEY FUNCTIONS
mc_rw(state, length, states, pred_length, show_table, show_prob, table_position, prob_position, font_size)
Builds the transition matrix for a rolling window Markov Chain.
Parameters:
state (string) : The current state of the market or system.
length (int) : The rolling window size.
states (array) : Array of strings representing the possible states in the Markov Chain.
pred_length (int) : The number of bars to predict into the future.
show_table (bool) : Boolean to show or hide the transition matrix table.
show_prob (bool) : Boolean to show or hide the probability table.
table_position (string) : Position of the transition matrix table on the chart.
prob_position (string) : Position of the probability list on the chart.
font_size (string) : Size of the table font.
Returns: The transition matrix and probabilities for future states.
mc_cond(state, condition, states, pred_length, show_table, show_prob, table_position, prob_position, font_size)
Builds the transition matrix for conditional Markov Chains.
Parameters:
state (string) : The current state of the market or system.
condition (string) : A string representing the condition.
states (array) : Array of strings representing the possible states in the Markov Chain.
pred_length (int) : The number of bars to predict into the future.
show_table (bool) : Boolean to show or hide the transition matrix table.
show_prob (bool) : Boolean to show or hide the probability table.
table_position (string) : Position of the transition matrix table on the chart.
prob_position (string) : Position of the probability list on the chart.
font_size (string) : Size of the table font.
Returns: The transition matrix and probabilities for future states based on the HMM.
Candlestick_patternsLibrary "CandlestickepatternsClase3"
TODO: add library description here
bullish_engulfing()
bearish_engulfing()
WavesLibrary "Waves"
Methods for elliot wave detection
method delete(this)
deletes the subwave drawing
Namespace types: Subwave
Parameters:
this (Subwave) : Subwave object to be deleted
Returns: deleted subwave object
method delete(this)
deletes the wave drawing and the corresponding subwaves
Namespace types: Wave
Parameters:
this (Wave) : Wave object to be deleted
Returns: deleted wave object
method createWave(pivot, lineColor, waves, limit)
Create wave object
Namespace types: zg.Pivot
Parameters:
pivot (Pivot type from Trendoscope/Zigzag/7) : pivot object where the wave needs to be created
lineColor (color) : color of the wave to be drawn
waves (array) : array of existing waves
limit (int) : max number of waves to be shown in the chart
Returns: wave object created
method createSubWaves(wave, subwavePivots)
Create sub waves for the wave
Namespace types: Wave
Parameters:
wave (Wave)
subwavePivots (array) : array of sub wave pivots
Returns: wave object created
method draw(subWave)
Draw subwave
Namespace types: Subwave
Parameters:
subWave (Subwave)
Returns: subwsubWave object
method draw(wave, limitSubwaves)
Draw Wave
Namespace types: Wave
Parameters:
wave (Wave) : Wave object to be drawn
limitSubwaves (bool) : limit the number of subwave combinations within the wave
Returns: wave object
method checkMotiveWave(prices)
based on the price array, check if there is motive wave and identify the type
Namespace types: array
Parameters:
prices (array) : float array of prices
Returns: WaveType representing the identified wave type. na otherwise
method scanMotiveWave(pivot, lastPivot, existingWaves, allowedTypes)
Scan for motive wave
Namespace types: zg.Pivot
Parameters:
pivot (Pivot type from Trendoscope/Zigzag/7) : Zigzag pivot that will be checked for motive wave
lastPivot (Pivot type from Trendoscope/Zigzag/7) : previous Zigzag pivot
existingWaves (array) : array of existing waves
allowedTypes (array) : allowed Wave types to filter them
Returns: array of subwave pivots
SubwavePivots
SubwavePivots represents the sub pivots of the main wave
Fields:
waveType (series WaveType) : Type of the Wave
indices (array) : Bar index values of sub waves
subPivots (array type from Trendoscope/Zigzag/7) : sub pivot objects of the wave
Subwave
Subwave represents the drawing of sub waves
Fields:
waves (array type from Trendoscope/Drawing/1) : array of sub wave lines
points (array type from Trendoscope/Drawing/1) : Array of subwave pivot labels
subwavePivots (SubwavePivots) : array of subwave pivots being drawn
Wave
Wave object type
Fields:
pivot (Pivot type from Trendoscope/Zigzag/7) : starting point of the wave
wave (Line type from Trendoscope/Drawing/1) : Line representing the wave
waveLabel (Label type from Trendoscope/Drawing/1) : label containing wave details
subWaves (array) : array of sub waves
lib_no_delayLibrary "lib_no_delay"
This library contains modifications to standard functions that return na before reaching the bar of their 'length' parameter.
That is because they do not compromise speed at current time for correct results in the past. This is good for live trading in short timeframes but killing applications on Monthly / Weekly timeframes if instruments, like in crypto, do not have extensive history (why would you even trade the monthly on a meme coin ... not my decision).
Also, some functions rely on source (value at previous bar), which is not available on bar 1 and therefore cascading to a na value up to the last bar ... which in turn leads to a non displaying indicator and waste of time debugging this)
Anyway ... there you go, let me know if I should add more functions.
sma(source, length)
Parameters:
source (float) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: Simple moving average of source for length bars back.
ema(source, length)
Parameters:
source (float) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: (float) The exponentially weighted moving average of the source.
rma(source, length)
Parameters:
source (float) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: Exponential moving average of source with alpha = 1 / length.
atr(length)
Function atr (average true range) returns the RMA of true range. True range is max(high - low, abs(high - close ), abs(low - close )). This adapted version extends ta.atr to start without delay at first bar and deliver usable data instead of na by averaging ta.tr(true) via manual SMA.
Parameters:
length (simple int) : Number of bars back (length).
Returns: Average true range.
rsi(source, length)
Relative strength index. It is calculated using the ta.rma() of upward and downward changes of source over the last length bars. This adapted version extends ta.rsi to start without delay at first bar and deliver usable data instead of na.
Parameters:
source (float) : Series of values to process.
length (simple int) : Number of bars back (length).
Returns: Relative Strength Index.
DynamicRSILibrary "DynamicRSI"
The "DynamicRSI" library provides a method to calculate a Dynamic Relative Strength Index (RSI) that adjusts its sensitivity based on market volatility. By combining short and long RSI periods with a weighted average influenced by the market's volatility, this library allows users to obtain a more responsive RSI tailored to changing market conditions.
"DynamicRSI" 라이브러리는 시장 변동성에 따라 감도를 조정하는 동적 상대 강도 지수(RSI)를 계산하는 방법을 제공합니다. 짧은 RSI와 긴 RSI 기간을 시장 변동성에 따라 가중 평균하여 결합함으로써, 이 라이브러리는 시장 상황에 맞게 보다 유연하게 반응하는 RSI를 제공합니다.
Function: drsi(src, minLength, maxLength, volatilityPeriod)
함수: drsi(src, minLength, maxLength, volatilityPeriod)
Parameters:
src (float)
The source data to calculate the RSI (e.g., close price). This is the price data that the RSI is calculated on.
RSI를 계산하기 위한 입력 데이터입니다(예: 종가(close) ). 이 값은 RSI를 계산하는 기준이 되는 가격 데이터입니다.
minLength (simple int)
The period for the shorter RSI. This parameter controls the sensitivity of the RSI, with a shorter period making the RSI more reactive to price changes.
짧은 RSI 기간입니다. 이 매개변수는 RSI의 감도를 제어하며, 더 짧은 기간은 RSI가 가격 변화에 더 민감하게 반응하게 합니다.
maxLength (simple int)
The period for the longer RSI. This parameter provides a smoother RSI, which is less sensitive to short-term price fluctuations.
긴 RSI 기간입니다. 이 매개변수는 더 부드러운 RSI를 제공하며, 단기적인 가격 변동에 덜 민감하게 반응합니다.
volatilityPeriod (simple int)
The period used for calculating the Average True Range (ATR) to measure market volatility. This volatility is then used to adjust the weighting between the short and long RSI, making the final Dynamic RSI more adaptive to market conditions.
시장 변동성을 측정하기 위해 평균 진정 범위(ATR)를 계산하는 기간입니다. 이 변동성을 기반으로 짧은 RSI와 긴 RSI 간의 가중치를 조정하여 최종 Dynamic RSI가 시장 상황에 더 잘 적응할 수 있도록 합니다.
Description:
The drsi function calculates a Dynamic RSI by weighting the short-term and long-term RSI values according to the current market volatility. The function uses the ATR to determine the market's volatility, applying more weight to the short-term RSI when volatility is high and more weight to the long-term RSI when volatility is low. This approach ensures that the RSI is more responsive during volatile periods and smoother during stable periods, providing traders with a more effective tool for identifying overbought and oversold conditions in varying market environments.
drsi 함수는 현재 시장 변동성에 따라 단기와 장기의 RSI 값을 가중치로 조정하여 Dynamic RSI를 계산합니다. 이 함수는 시장의 변동성을 판단하기 위해 ATR을 사용하며, 변동성이 높을 때는 단기 RSI에 더 많은 가중치를 적용하고, 변동성이 낮을 때는 장기 RSI에 더 많은 가중치를 적용합니다. 이 접근 방식은 변동성이 큰 기간 동안 RSI가 더 민감하게 반응하고, 안정적인 기간 동안 더 부드럽게 반응하도록 하여, 다양한 시장 환경에서 과매수 및 과매도 상태를 식별하는 데 보다 효과적인 도구를 제공합니다.
Order Block Overlapping Drawing [TradingFinder]🔵 Introduction
Technical analysis is a fundamental tool in financial markets, helping traders identify key areas on price charts to make informed trading decisions. The ICT (Inner Circle Trader) style, developed by Michael Huddleston, is one of the most advanced methods in this field.
It enables traders to precisely identify and exploit critical zones such as Order Blocks, Breaker Blocks, Fair Value Gaps (FVGs), and Inversion Fair Value Gaps (IFVGs).
To streamline and simplify the use of these key areas, a library has been developed in Pine Script, the scripting language for the TradingView platform. This library allows you to automatically detect overlapping zones between Order Blocks and other similar areas, and visually display them on your chart.
This tool is particularly useful for creating indicators like Balanced Price Range (BPR) and ICT Unicorn Model.
🔵 How to Use
This section explains how to use the Pine Script library. This library assists you in easily identifying and analyzing overlapping areas between Order Blocks and other zones, such as Breaker Blocks and Fair Value Gaps.
To add "Order Block Overlapping Drawing", you must first add the following code to your script.
import TFlab/OrderBlockOverlappingDrawing/1
🟣 Inputs
The library includes the "OBOverlappingDrawing" function, which you can use to detect and display overlapping zones. This function identifies and draws overlapping zones based on the Order Block type, trigger conditions, previous and current prices, and other relevant parameters.
🟣 Parameters
OBOverlappingDrawing(OBType , TriggerConditionOrigin, distalPrice_Pre, proximalPrice_Pre , distalPrice_Curr, proximalPrice_Curr, Index_Curr , OBValidGlobal, OBValidDis, MitigationLvL, ShowAll, Show, ColorZone) =>
OBType (string)
TriggerConditionOrigin (bool)
distalPrice_Pre (float)
proximalPrice_Pre (float)
distalPrice_Curr (float)
proximalPrice_Curr (float)
Index_Curr (int)
OBValidGlobal (bool)
OBValidDis (int)
MitigationLvL (string)
ShowAll (bool)
Show (bool)
ColorZone (color)
In this example, various parameters are defined to detect overlapping zones and draw them on the chart. Based on these settings, the overlapping areas will be automatically drawn on the chart.
OBType : All order blocks are summarized into two types: "Supply" and "Demand." You should input your Current order block type in this parameter. Enter "Demand" for drawing demand zones and "Supply" for drawing supply zones.
TriggerConditionOrigin : Input the condition under which you want the Current order block to be drawn in this parameter.
distalPrice_Pre : Generally, if each zone is formed by two lines, the farthest line from the price is termed Pervious "Distal." This input receives the price of the "Distal" line.
proximalPrice_Pre : Generally, if each zone is formed by two lines, the nearest line to the price is termed Previous "Proximal" line.
distalPrice_Curr : Generally, if each zone is formed by two lines, the farthest line from the price is termed Current "Distal." This input receives the price of the "Distal" line.
proximalPrice_Curr : Generally, if each zone is formed by two lines, the nearest line to the price is termed Current "Proximal" line.
Index_Curr : This input receives the value of the "bar_index" at the beginning of the order block. You should store the "bar_index" value at the occurrence of the condition for the Current order block to be drawn and input it here.
OBValidGlobal : This parameter is a boolean in which you can enter the condition that you want to execute to stop drawing the block order. If you do not have a special condition, you should set it to True.
OBValidDis : Order blocks continue to be drawn until a new order block is drawn or the order block is "Mitigate." You can specify how many candles after their initiation order blocks should continue. If you want no limitation, enter the number 4998.
MitigationLvL : This parameter is a string. Its inputs are one of "Proximal", "Distal" or "50 % OB" modes, which you can enter according to your needs. The "50 % OB" line is the middle line between distal and proximal.
ShowAll : This is a boolean parameter, if it is "true" the entire order of blocks will be displayed, and if it is "false" only the last block order will be displayed.
Show : You may need to manage whether to display or hide order blocks. When this input is "On", order blocks are displayed, and when it's "Off", order blocks are not displayed.
ColorZone : You can input your preferred color for drawing order blocks.
🟣 Output
Mitigation Alerts : This library allows you to leverage Mitigation Alerts to detect specific conditions that could lead to trend reversals. These alerts help you react promptly in your trades, ensuring better management of market shifts.
🔵 Conclusion
The Pine Script library provided is a powerful tool for technical analysis, especially in the ICT style. It enables you to detect overlapping zones between Order Blocks and other significant areas like Breaker Blocks and Fair Value Gaps, improving your trading strategies. By utilizing this tool, you can perform more precise analysis and manage risks effectively in your trades.
COMET_Scanner_Library_FINALLibrary "COMET_Scanner_Library"
- A Trader's Edge (ATE)_Library was created to assist in constructing COM Scanners
TickerIDs(_string)
TickerIDs: You must form this single tickerID input string exactly as described in the scripts info panel (little gray 'i' that
is circled at the end of the settings in the settings/input panel that you can hover your cursor over this 'i' to read the
details of that particular input). IF the string is formed correctly then it will break up this single string parameter into
a total of 40 separate strings which will be all of the tickerIDs that the script is using in your COM Scanner.
Parameters:
_string (simple string) : (string)
A maximum of 40 Tickers (ALL joined as 1 string for the input parameter) that is formulated EXACTLY as described
within the tooltips of the TickerID inputs in my COM Scanner scripts:
assets = input.text_area(tIDs, title="TickerIDs (MUST READ TOOLTIP)", group=g2, tooltip="Accepts 40 TICKERID's
for each copy of the script on the chart. *** MUST FORMAT THIS WAY *** Each FULL tickerID
(ie 'Exchange:ticker') must be separated by A SINGLE BLANK SPACE for correct formatting. The blank space tells
the script where to break off the ticker to assign it to a variable to be used later in the script. So this input
will be a single string constructed from up to 40 tickerID's with a space between each tickerID
(ie. 'BINANCE:BTCUSDT BINANCE:SXPUSDT BINANCE:XRPUSDT').", display=display.none)
Returns: Returns 40 output variables in the tuple (ie. between the ' ') with the separated TickerIDs,
Locations(_firstLocation)
Locations: This function is used when there's a desire to print an assets ALERT LABELS. A set Location on the scale is assigned to each asset.
This is created so that if a lot of alerts are triggered, they will stay relatively visible and not overlap each other.
If you set your '_firstLocation' parameter as 1, since there are a max of 40 assets that can be scanned, the 1st asset's location
is assigned the value in the '_firstLocation' parameter, the 2nd asset's location is the (1st asset's location+1)...and so on.
Parameters:
_firstLocation (simple int) : (simple int)
Optional (starts at 1 if no parameter added).
Location that you want the first asset to print its label if is triggered to do so.
ie. loc2=loc1+1, loc3=loc2+1, etc.
Returns: Returns 40 variables for the locations for alert labels
LabelSize(_barCnt, _lblSzRfrnce)
INVALID TICKERIDs: This is to add a table in the middle right of your chart that prints all the TickerID's that were either not formulated
correctly in the '_source' input or that is not a valid symbol and should be changed.
LABEL SIZES: This function sizes your Alert Trigger Labels according to the amount of Printed Bars the chart has printed within
a set time period, while also keeping in mind the smallest relative reference size you input in the 'lblSzRfrnceInput'
parameter of this function. A HIGHER % of Printed Bars(aka...more trades occurring for that asset on the exchange),
the LARGER the Name Label will print, potentially showing you the better opportunities on the exchange to avoid
exchange manipulation liquidations.
*** SHOULD NOT be used as size of labels that are your asset Name Labels next to each asset's Line Plot...
if your COM Scanner includes these as you want these to be the same size for every asset so the larger ones dont cover the
smaller ones if the plots are all close to each other ***
Parameters:
_barCnt (float) : (float)
Get the 1st variable('barCnt') from the Security function's tuple and input it as this functions 1st input
parameter which will directly affect the size of the 2nd output variable ('alertTrigLabel') that is also outputted by this function.
_lblSzRfrnce (string) : (string)
Optional (if parameter not included, it defaults to size.small). This will be the size of the variable outputted
by this function named 'assetNameLabel' BUT also affects the size of the output variable 'alertTrigLabel' as it uses this parameter's size
as the smallest size for 'alertTrigLabel' then uses the '_barCnt' parameter to determine the next sizes up depending on the "_barCnt" value.
Returns: ( )
Returns 2 variables:
1st output variable ('AssetNameLabel') is assigned to the size of the 'lblSzRfrnceInput' parameter.
2nd output variable('alertTrigLabel') can be of variying sizes depending on the 'barCnt' parameter...BUT the smallest
size possible for the 2nd output variable ('alertTrigLabel') will be the size set in the 'lblSzRfrnceInput' parameter.
InvalidTickerIDs(_close, _securityTickerid, _invalidArray, _tablePosition, _stackVertical)
Parameters:
_close (float)
_securityTickerid (string)
_invalidArray (array)
_tablePosition (simple string)
_stackVertical (simple bool)
PrintedBarCount(_time, _barCntLength, _barCntPercentMin)
The Printed BarCount Filter looks back a User Defined amount of minutes and calculates the % of bars that have printed
out of the TOTAL amount of bars that COULD HAVE been printed within the same amount of time.
Parameters:
_time (int) : (int)
The time associated with the chart of the particular asset that is being screened at that point.
_barCntLength (int) : (int)
The amount of time (IN MINUTES) that you want the logic to look back at to calculate the % of bars that have actually
printed in the span of time you input into this parameter.
_barCntPercentMin (int) : (int)
The minimum % of Printed Bars of the asset being screened has to be GREATER than the value set in this parameter
for the output variable 'bc_gtg' to be true.
Returns: ( )
Returns 2 outputs:
1st is the % of Printed Bars that have printed within the within the span of time you input in the '_barCntLength' parameter.
2nd is true/false according to if the Printed BarCount % is above the threshold that you input into the '_barCntPercentMin' parameter.
CRSILibrary "CRSI"
Cumulative Relative Strength Index
crsi(length, cumlength, source)
Calculates cumulative relative strength index
Parameters:
length (simple int)
cumlength (int)
source (float)
Returns: crsi
PubLibPatternLibrary "PubLibPattern"
pattern conditions for indicator and strategy development
bear_5_0(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish 5-0 harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_5_0(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish 5-0 harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_abcd(bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish abcd harmonic pattern condition
Parameters:
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_abcd(bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish abcd harmonic pattern condition
Parameters:
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_alt_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish alternate bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_alt_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish alternate bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_butterfly(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish butterfly harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_butterfly(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish butterfly harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_cassiopeia_a(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish cassiopeia a harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_cassiopeia_a(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish cassiopeia a harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_cassiopeia_b(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish cassiopeia b harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_cassiopeia_b(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish cassiopeia b harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_cassiopeia_c(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish cassiopeia c harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_cassiopeia_c(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish cassiopeia c harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_deep_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish deep crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_deep_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish deep crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_cypher(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, xc_low_tol, xc_up_tol)
bearish cypher harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bull_cypher(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, xc_low_tol, xc_up_tol)
bullish cypher harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bear_gartley(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish gartley harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_gartley(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish gartley harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_shark(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, xc_low_tol, xc_up_tol)
bearish shark harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bull_shark(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, xc_low_tol, xc_up_tol)
bullish shark harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bear_three_drive(x1_low_tol, a1_low_tol, a1_up_tol, a2_low_tol, a2_up_tol, b2_low_tol, b2_up_tol, b3_low_tol, b3_upt_tol)
bearish three drive harmonic pattern condition
Parameters:
x1_low_tol (float)
a1_low_tol (float)
a1_up_tol (float)
a2_low_tol (float)
a2_up_tol (float)
b2_low_tol (float)
b2_up_tol (float)
b3_low_tol (float)
b3_upt_tol (float)
Returns: bool
bull_three_drive(x1_low_tol, a1_low_tol, a1_up_tol, a2_low_tol, a2_up_tol, b2_low_tol, b2_up_tol, b3_low_tol, b3_upt_tol)
bullish three drive harmonic pattern condition
Parameters:
x1_low_tol (float)
a1_low_tol (float)
a1_up_tol (float)
a2_low_tol (float)
a2_up_tol (float)
b2_low_tol (float)
b2_up_tol (float)
b3_low_tol (float)
b3_upt_tol (float)
Returns: bool
asc_broadening()
ascending broadening pattern condition
Returns: bool
broadening()
broadening pattern condition
Returns: bool
desc_broadening()
descending broadening pattern condition
Returns: bool
double_bot(low_tol, up_tol)
double bottom pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
double_top(low_tol, up_tol)
double top pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
triple_bot(low_tol, up_tol)
triple bottom pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
triple_top(low_tol, up_tol)
triple top pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
bear_elliot()
bearish elliot wave pattern condition
Returns: bool
bull_elliot()
bullish elliot wave pattern condition
Returns: bool
bear_alt_flag(ab_ratio, bc_ratio)
bearish alternate flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
bull_alt_flag(ab_ratio, bc_ratio)
bullish alternate flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
bear_flag(ab_ratio, bc_ratio, be_ratio)
bearish flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
be_ratio (float)
Returns: bool
bull_flag(ab_ratio, bc_ratio, be_ratio)
bullish flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
be_ratio (float)
Returns: bool
bear_asc_head_shoulders()
bearish ascending head and shoulders pattern condition
Returns: bool
bull_asc_head_shoulders()
bullish ascending head and shoulders pattern condition
Returns: bool
bear_desc_head_shoulders()
bearish descending head and shoulders pattern condition
Returns: bool
bull_desc_head_shoulders()
bullish descending head and shoulders pattern condition
Returns: bool
bear_head_shoulders()
bearish head and shoulders pattern condition
Returns: bool
bull_head_shoulders()
bullish head and shoulders pattern condition
Returns: bool
bear_pennant(ab_ratio, bc_ratio)
bearish pennant pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
bull_pennant(ab_ratio, bc_ratio)
bullish pennant pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
asc_wedge()
ascending wedge pattern condition
Returns: bool
desc_wedge()
descending wedge pattern condition
Returns: bool
wedge()
wedge pattern condition
Returns: bool
PubLibTrendLibrary "PubLibTrend"
trend, multi-part trend, double trend and multi-part double trend conditions for indicator and strategy development
rlut()
return line uptrend condition
Returns: bool
dt()
downtrend condition
Returns: bool
ut()
uptrend condition
Returns: bool
rldt()
return line downtrend condition
Returns: bool
dtop()
double top condition
Returns: bool
dbot()
double bottom condition
Returns: bool
rlut_1p()
1-part return line uptrend condition
Returns: bool
rlut_2p()
2-part return line uptrend condition
Returns: bool
rlut_3p()
3-part return line uptrend condition
Returns: bool
rlut_4p()
4-part return line uptrend condition
Returns: bool
rlut_5p()
5-part return line uptrend condition
Returns: bool
rlut_6p()
6-part return line uptrend condition
Returns: bool
rlut_7p()
7-part return line uptrend condition
Returns: bool
rlut_8p()
8-part return line uptrend condition
Returns: bool
rlut_9p()
9-part return line uptrend condition
Returns: bool
rlut_10p()
10-part return line uptrend condition
Returns: bool
rlut_11p()
11-part return line uptrend condition
Returns: bool
rlut_12p()
12-part return line uptrend condition
Returns: bool
rlut_13p()
13-part return line uptrend condition
Returns: bool
rlut_14p()
14-part return line uptrend condition
Returns: bool
rlut_15p()
15-part return line uptrend condition
Returns: bool
rlut_16p()
16-part return line uptrend condition
Returns: bool
rlut_17p()
17-part return line uptrend condition
Returns: bool
rlut_18p()
18-part return line uptrend condition
Returns: bool
rlut_19p()
19-part return line uptrend condition
Returns: bool
rlut_20p()
20-part return line uptrend condition
Returns: bool
rlut_21p()
21-part return line uptrend condition
Returns: bool
rlut_22p()
22-part return line uptrend condition
Returns: bool
rlut_23p()
23-part return line uptrend condition
Returns: bool
rlut_24p()
24-part return line uptrend condition
Returns: bool
rlut_25p()
25-part return line uptrend condition
Returns: bool
rlut_26p()
26-part return line uptrend condition
Returns: bool
rlut_27p()
27-part return line uptrend condition
Returns: bool
rlut_28p()
28-part return line uptrend condition
Returns: bool
rlut_29p()
29-part return line uptrend condition
Returns: bool
rlut_30p()
30-part return line uptrend condition
Returns: bool
dt_1p()
1-part downtrend condition
Returns: bool
dt_2p()
2-part downtrend condition
Returns: bool
dt_3p()
3-part downtrend condition
Returns: bool
dt_4p()
4-part downtrend condition
Returns: bool
dt_5p()
5-part downtrend condition
Returns: bool
dt_6p()
6-part downtrend condition
Returns: bool
dt_7p()
7-part downtrend condition
Returns: bool
dt_8p()
8-part downtrend condition
Returns: bool
dt_9p()
9-part downtrend condition
Returns: bool
dt_10p()
10-part downtrend condition
Returns: bool
dt_11p()
11-part downtrend condition
Returns: bool
dt_12p()
12-part downtrend condition
Returns: bool
dt_13p()
13-part downtrend condition
Returns: bool
dt_14p()
14-part downtrend condition
Returns: bool
dt_15p()
15-part downtrend condition
Returns: bool
dt_16p()
16-part downtrend condition
Returns: bool
dt_17p()
17-part downtrend condition
Returns: bool
dt_18p()
18-part downtrend condition
Returns: bool
dt_19p()
19-part downtrend condition
Returns: bool
dt_20p()
20-part downtrend condition
Returns: bool
dt_21p()
21-part downtrend condition
Returns: bool
dt_22p()
22-part downtrend condition
Returns: bool
dt_23p()
23-part downtrend condition
Returns: bool
dt_24p()
24-part downtrend condition
Returns: bool
dt_25p()
25-part downtrend condition
Returns: bool
dt_26p()
26-part downtrend condition
Returns: bool
dt_27p()
27-part downtrend condition
Returns: bool
dt_28p()
28-part downtrend condition
Returns: bool
dt_29p()
29-part downtrend condition
Returns: bool
dt_30p()
30-part downtrend condition
Returns: bool
ut_1p()
1-part uptrend condition
Returns: bool
ut_2p()
2-part uptrend condition
Returns: bool
ut_3p()
3-part uptrend condition
Returns: bool
ut_4p()
4-part uptrend condition
Returns: bool
ut_5p()
5-part uptrend condition
Returns: bool
ut_6p()
6-part uptrend condition
Returns: bool
ut_7p()
7-part uptrend condition
Returns: bool
ut_8p()
8-part uptrend condition
Returns: bool
ut_9p()
9-part uptrend condition
Returns: bool
ut_10p()
10-part uptrend condition
Returns: bool
ut_11p()
11-part uptrend condition
Returns: bool
ut_12p()
12-part uptrend condition
Returns: bool
ut_13p()
13-part uptrend condition
Returns: bool
ut_14p()
14-part uptrend condition
Returns: bool
ut_15p()
15-part uptrend condition
Returns: bool
ut_16p()
16-part uptrend condition
Returns: bool
ut_17p()
17-part uptrend condition
Returns: bool
ut_18p()
18-part uptrend condition
Returns: bool
ut_19p()
19-part uptrend condition
Returns: bool
ut_20p()
20-part uptrend condition
Returns: bool
ut_21p()
21-part uptrend condition
Returns: bool
ut_22p()
22-part uptrend condition
Returns: bool
ut_23p()
23-part uptrend condition
Returns: bool
ut_24p()
24-part uptrend condition
Returns: bool
ut_25p()
25-part uptrend condition
Returns: bool
ut_26p()
26-part uptrend condition
Returns: bool
ut_27p()
27-part uptrend condition
Returns: bool
ut_28p()
28-part uptrend condition
Returns: bool
ut_29p()
29-part uptrend condition
Returns: bool
ut_30p()
30-part uptrend condition
Returns: bool
rldt_1p()
1-part return line downtrend condition
Returns: bool
rldt_2p()
2-part return line downtrend condition
Returns: bool
rldt_3p()
3-part return line downtrend condition
Returns: bool
rldt_4p()
4-part return line downtrend condition
Returns: bool
rldt_5p()
5-part return line downtrend condition
Returns: bool
rldt_6p()
6-part return line downtrend condition
Returns: bool
rldt_7p()
7-part return line downtrend condition
Returns: bool
rldt_8p()
8-part return line downtrend condition
Returns: bool
rldt_9p()
9-part return line downtrend condition
Returns: bool
rldt_10p()
10-part return line downtrend condition
Returns: bool
rldt_11p()
11-part return line downtrend condition
Returns: bool
rldt_12p()
12-part return line downtrend condition
Returns: bool
rldt_13p()
13-part return line downtrend condition
Returns: bool
rldt_14p()
14-part return line downtrend condition
Returns: bool
rldt_15p()
15-part return line downtrend condition
Returns: bool
rldt_16p()
16-part return line downtrend condition
Returns: bool
rldt_17p()
17-part return line downtrend condition
Returns: bool
rldt_18p()
18-part return line downtrend condition
Returns: bool
rldt_19p()
19-part return line downtrend condition
Returns: bool
rldt_20p()
20-part return line downtrend condition
Returns: bool
rldt_21p()
21-part return line downtrend condition
Returns: bool
rldt_22p()
22-part return line downtrend condition
Returns: bool
rldt_23p()
23-part return line downtrend condition
Returns: bool
rldt_24p()
24-part return line downtrend condition
Returns: bool
rldt_25p()
25-part return line downtrend condition
Returns: bool
rldt_26p()
26-part return line downtrend condition
Returns: bool
rldt_27p()
27-part return line downtrend condition
Returns: bool
rldt_28p()
28-part return line downtrend condition
Returns: bool
rldt_29p()
29-part return line downtrend condition
Returns: bool
rldt_30p()
30-part return line downtrend condition
Returns: bool
dut()
double uptrend condition
Returns: bool
ddt()
double downtrend condition
Returns: bool
dut_1p()
1-part double uptrend condition
Returns: bool
dut_2p()
2-part double uptrend condition
Returns: bool
dut_3p()
3-part double uptrend condition
Returns: bool
dut_4p()
4-part double uptrend condition
Returns: bool
dut_5p()
5-part double uptrend condition
Returns: bool
dut_6p()
6-part double uptrend condition
Returns: bool
dut_7p()
7-part double uptrend condition
Returns: bool
dut_8p()
8-part double uptrend condition
Returns: bool
dut_9p()
9-part double uptrend condition
Returns: bool
dut_10p()
10-part double uptrend condition
Returns: bool
dut_11p()
11-part double uptrend condition
Returns: bool
dut_12p()
12-part double uptrend condition
Returns: bool
dut_13p()
13-part double uptrend condition
Returns: bool
dut_14p()
14-part double uptrend condition
Returns: bool
dut_15p()
15-part double uptrend condition
Returns: bool
dut_16p()
16-part double uptrend condition
Returns: bool
dut_17p()
17-part double uptrend condition
Returns: bool
dut_18p()
18-part double uptrend condition
Returns: bool
dut_19p()
19-part double uptrend condition
Returns: bool
dut_20p()
20-part double uptrend condition
Returns: bool
dut_21p()
21-part double uptrend condition
Returns: bool
dut_22p()
22-part double uptrend condition
Returns: bool
dut_23p()
23-part double uptrend condition
Returns: bool
dut_24p()
24-part double uptrend condition
Returns: bool
dut_25p()
25-part double uptrend condition
Returns: bool
dut_26p()
26-part double uptrend condition
Returns: bool
dut_27p()
27-part double uptrend condition
Returns: bool
dut_28p()
28-part double uptrend condition
Returns: bool
dut_29p()
29-part double uptrend condition
Returns: bool
dut_30p()
30-part double uptrend condition
Returns: bool
ddt_1p()
1-part double downtrend condition
Returns: bool
ddt_2p()
2-part double downtrend condition
Returns: bool
ddt_3p()
3-part double downtrend condition
Returns: bool
ddt_4p()
4-part double downtrend condition
Returns: bool
ddt_5p()
5-part double downtrend condition
Returns: bool
ddt_6p()
6-part double downtrend condition
Returns: bool
ddt_7p()
7-part double downtrend condition
Returns: bool
ddt_8p()
8-part double downtrend condition
Returns: bool
ddt_9p()
9-part double downtrend condition
Returns: bool
ddt_10p()
10-part double downtrend condition
Returns: bool
ddt_11p()
11-part double downtrend condition
Returns: bool
ddt_12p()
12-part double downtrend condition
Returns: bool
ddt_13p()
13-part double downtrend condition
Returns: bool
ddt_14p()
14-part double downtrend condition
Returns: bool
ddt_15p()
15-part double downtrend condition
Returns: bool
ddt_16p()
16-part double downtrend condition
Returns: bool
ddt_17p()
17-part double downtrend condition
Returns: bool
ddt_18p()
18-part double downtrend condition
Returns: bool
ddt_19p()
19-part double downtrend condition
Returns: bool
ddt_20p()
20-part double downtrend condition
Returns: bool
ddt_21p()
21-part double downtrend condition
Returns: bool
ddt_22p()
22-part double downtrend condition
Returns: bool
ddt_23p()
23-part double downtrend condition
Returns: bool
ddt_24p()
24-part double downtrend condition
Returns: bool
ddt_25p()
25-part double downtrend condition
Returns: bool
ddt_26p()
26-part double downtrend condition
Returns: bool
ddt_27p()
27-part double downtrend condition
Returns: bool
ddt_28p()
28-part double downtrend condition
Returns: bool
ddt_29p()
29-part double downtrend condition
Returns: bool
ddt_30p()
30-part double downtrend condition
Returns: bool
PubLibSwingLibrary "PubLibSwing"
swing high and swing low conditions, prices, bar indices and range ratios for indicator and strategy development
sh()
swing high condition
Returns: bool
sl()
swing low condition
Returns: bool
shbi(occ)
swing high bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
slbi(occ)
swing low bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
shcp(occ)
swing high close price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
slcp(occ)
swing low close price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
shp(occ)
swing high price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
slp(occ)
swing low price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
shpbi(occ)
swing high price bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
slpbi(occ)
swing low price bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
shrr(occ)
swing high range ratio, condition occurrence n
Parameters:
occ (simple int)
Returns: float
slrr(occ)
swing low range ratio, condition occurrence n
Parameters:
occ (simple int)
Returns: float
PubLibCandleTrendLibrary "PubLibCandleTrend"
candle trend, multi-part candle trend, multi-part green/red candle trend, double candle trend and multi-part double candle trend conditions for indicator and strategy development
chh()
candle higher high condition
Returns: bool
chl()
candle higher low condition
Returns: bool
clh()
candle lower high condition
Returns: bool
cll()
candle lower low condition
Returns: bool
cdt()
candle double top condition
Returns: bool
cdb()
candle double bottom condition
Returns: bool
gc()
green candle condition
Returns: bool
gchh()
green candle higher high condition
Returns: bool
gchl()
green candle higher low condition
Returns: bool
gclh()
green candle lower high condition
Returns: bool
gcll()
green candle lower low condition
Returns: bool
gcdt()
green candle double top condition
Returns: bool
gcdb()
green candle double bottom condition
Returns: bool
rc()
red candle condition
Returns: bool
rchh()
red candle higher high condition
Returns: bool
rchl()
red candle higher low condition
Returns: bool
rclh()
red candle lower high condition
Returns: bool
rcll()
red candle lower low condition
Returns: bool
rcdt()
red candle double top condition
Returns: bool
rcdb()
red candle double bottom condition
Returns: bool
chh_1p()
1-part candle higher high condition
Returns: bool
chh_2p()
2-part candle higher high condition
Returns: bool
chh_3p()
3-part candle higher high condition
Returns: bool
chh_4p()
4-part candle higher high condition
Returns: bool
chh_5p()
5-part candle higher high condition
Returns: bool
chh_6p()
6-part candle higher high condition
Returns: bool
chh_7p()
7-part candle higher high condition
Returns: bool
chh_8p()
8-part candle higher high condition
Returns: bool
chh_9p()
9-part candle higher high condition
Returns: bool
chh_10p()
10-part candle higher high condition
Returns: bool
chh_11p()
11-part candle higher high condition
Returns: bool
chh_12p()
12-part candle higher high condition
Returns: bool
chh_13p()
13-part candle higher high condition
Returns: bool
chh_14p()
14-part candle higher high condition
Returns: bool
chh_15p()
15-part candle higher high condition
Returns: bool
chh_16p()
16-part candle higher high condition
Returns: bool
chh_17p()
17-part candle higher high condition
Returns: bool
chh_18p()
18-part candle higher high condition
Returns: bool
chh_19p()
19-part candle higher high condition
Returns: bool
chh_20p()
20-part candle higher high condition
Returns: bool
chh_21p()
21-part candle higher high condition
Returns: bool
chh_22p()
22-part candle higher high condition
Returns: bool
chh_23p()
23-part candle higher high condition
Returns: bool
chh_24p()
24-part candle higher high condition
Returns: bool
chh_25p()
25-part candle higher high condition
Returns: bool
chh_26p()
26-part candle higher high condition
Returns: bool
chh_27p()
27-part candle higher high condition
Returns: bool
chh_28p()
28-part candle higher high condition
Returns: bool
chh_29p()
29-part candle higher high condition
Returns: bool
chh_30p()
30-part candle higher high condition
Returns: bool
chl_1p()
1-part candle higher low condition
Returns: bool
chl_2p()
2-part candle higher low condition
Returns: bool
chl_3p()
3-part candle higher low condition
Returns: bool
chl_4p()
4-part candle higher low condition
Returns: bool
chl_5p()
5-part candle higher low condition
Returns: bool
chl_6p()
6-part candle higher low condition
Returns: bool
chl_7p()
7-part candle higher low condition
Returns: bool
chl_8p()
8-part candle higher low condition
Returns: bool
chl_9p()
9-part candle higher low condition
Returns: bool
chl_10p()
10-part candle higher low condition
Returns: bool
chl_11p()
11-part candle higher low condition
Returns: bool
chl_12p()
12-part candle higher low condition
Returns: bool
chl_13p()
13-part candle higher low condition
Returns: bool
chl_14p()
14-part candle higher low condition
Returns: bool
chl_15p()
15-part candle higher low condition
Returns: bool
chl_16p()
16-part candle higher low condition
Returns: bool
chl_17p()
17-part candle higher low condition
Returns: bool
chl_18p()
18-part candle higher low condition
Returns: bool
chl_19p()
19-part candle higher low condition
Returns: bool
chl_20p()
20-part candle higher low condition
Returns: bool
chl_21p()
21-part candle higher low condition
Returns: bool
chl_22p()
22-part candle higher low condition
Returns: bool
chl_23p()
23-part candle higher low condition
Returns: bool
chl_24p()
24-part candle higher low condition
Returns: bool
chl_25p()
25-part candle higher low condition
Returns: bool
chl_26p()
26-part candle higher low condition
Returns: bool
chl_27p()
27-part candle higher low condition
Returns: bool
chl_28p()
28-part candle higher low condition
Returns: bool
chl_29p()
29-part candle higher low condition
Returns: bool
chl_30p()
30-part candle higher low condition
Returns: bool
clh_1p()
1-part candle lower high condition
Returns: bool
clh_2p()
2-part candle lower high condition
Returns: bool
clh_3p()
3-part candle lower high condition
Returns: bool
clh_4p()
4-part candle lower high condition
Returns: bool
clh_5p()
5-part candle lower high condition
Returns: bool
clh_6p()
6-part candle lower high condition
Returns: bool
clh_7p()
7-part candle lower high condition
Returns: bool
clh_8p()
8-part candle lower high condition
Returns: bool
clh_9p()
9-part candle lower high condition
Returns: bool
clh_10p()
10-part candle lower high condition
Returns: bool
clh_11p()
11-part candle lower high condition
Returns: bool
clh_12p()
12-part candle lower high condition
Returns: bool
clh_13p()
13-part candle lower high condition
Returns: bool
clh_14p()
14-part candle lower high condition
Returns: bool
clh_15p()
15-part candle lower high condition
Returns: bool
clh_16p()
16-part candle lower high condition
Returns: bool
clh_17p()
17-part candle lower high condition
Returns: bool
clh_18p()
18-part candle lower high condition
Returns: bool
clh_19p()
19-part candle lower high condition
Returns: bool
clh_20p()
20-part candle lower high condition
Returns: bool
clh_21p()
21-part candle lower high condition
Returns: bool
clh_22p()
22-part candle lower high condition
Returns: bool
clh_23p()
23-part candle lower high condition
Returns: bool
clh_24p()
24-part candle lower high condition
Returns: bool
clh_25p()
25-part candle lower high condition
Returns: bool
clh_26p()
26-part candle lower high condition
Returns: bool
clh_27p()
27-part candle lower high condition
Returns: bool
clh_28p()
28-part candle lower high condition
Returns: bool
clh_29p()
29-part candle lower high condition
Returns: bool
clh_30p()
30-part candle lower high condition
Returns: bool
cll_1p()
1-part candle lower low condition
Returns: bool
cll_2p()
2-part candle lower low condition
Returns: bool
cll_3p()
3-part candle lower low condition
Returns: bool
cll_4p()
4-part candle lower low condition
Returns: bool
cll_5p()
5-part candle lower low condition
Returns: bool
cll_6p()
6-part candle lower low condition
Returns: bool
cll_7p()
7-part candle lower low condition
Returns: bool
cll_8p()
8-part candle lower low condition
Returns: bool
cll_9p()
9-part candle lower low condition
Returns: bool
cll_10p()
10-part candle lower low condition
Returns: bool
cll_11p()
11-part candle lower low condition
Returns: bool
cll_12p()
12-part candle lower low condition
Returns: bool
cll_13p()
13-part candle lower low condition
Returns: bool
cll_14p()
14-part candle lower low condition
Returns: bool
cll_15p()
15-part candle lower low condition
Returns: bool
cll_16p()
16-part candle lower low condition
Returns: bool
cll_17p()
17-part candle lower low condition
Returns: bool
cll_18p()
18-part candle lower low condition
Returns: bool
cll_19p()
19-part candle lower low condition
Returns: bool
cll_20p()
20-part candle lower low condition
Returns: bool
cll_21p()
21-part candle lower low condition
Returns: bool
cll_22p()
22-part candle lower low condition
Returns: bool
cll_23p()
23-part candle lower low condition
Returns: bool
cll_24p()
24-part candle lower low condition
Returns: bool
cll_25p()
25-part candle lower low condition
Returns: bool
cll_26p()
26-part candle lower low condition
Returns: bool
cll_27p()
27-part candle lower low condition
Returns: bool
cll_28p()
28-part candle lower low condition
Returns: bool
cll_29p()
29-part candle lower low condition
Returns: bool
cll_30p()
30-part candle lower low condition
Returns: bool
gc_1p()
1-part green candle condition
Returns: bool
gc_2p()
2-part green candle condition
Returns: bool
gc_3p()
3-part green candle condition
Returns: bool
gc_4p()
4-part green candle condition
Returns: bool
gc_5p()
5-part green candle condition
Returns: bool
gc_6p()
6-part green candle condition
Returns: bool
gc_7p()
7-part green candle condition
Returns: bool
gc_8p()
8-part green candle condition
Returns: bool
gc_9p()
9-part green candle condition
Returns: bool
gc_10p()
10-part green candle condition
Returns: bool
gc_11p()
11-part green candle condition
Returns: bool
gc_12p()
12-part green candle condition
Returns: bool
gc_13p()
13-part green candle condition
Returns: bool
gc_14p()
14-part green candle condition
Returns: bool
gc_15p()
15-part green candle condition
Returns: bool
gc_16p()
16-part green candle condition
Returns: bool
gc_17p()
17-part green candle condition
Returns: bool
gc_18p()
18-part green candle condition
Returns: bool
gc_19p()
19-part green candle condition
Returns: bool
gc_20p()
20-part green candle condition
Returns: bool
gc_21p()
21-part green candle condition
Returns: bool
gc_22p()
22-part green candle condition
Returns: bool
gc_23p()
23-part green candle condition
Returns: bool
gc_24p()
24-part green candle condition
Returns: bool
gc_25p()
25-part green candle condition
Returns: bool
gc_26p()
26-part green candle condition
Returns: bool
gc_27p()
27-part green candle condition
Returns: bool
gc_28p()
28-part green candle condition
Returns: bool
gc_29p()
29-part green candle condition
Returns: bool
gc_30p()
30-part green candle condition
Returns: bool
rc_1p()
1-part red candle condition
Returns: bool
rc_2p()
2-part red candle condition
Returns: bool
rc_3p()
3-part red candle condition
Returns: bool
rc_4p()
4-part red candle condition
Returns: bool
rc_5p()
5-part red candle condition
Returns: bool
rc_6p()
6-part red candle condition
Returns: bool
rc_7p()
7-part red candle condition
Returns: bool
rc_8p()
8-part red candle condition
Returns: bool
rc_9p()
9-part red candle condition
Returns: bool
rc_10p()
10-part red candle condition
Returns: bool
rc_11p()
11-part red candle condition
Returns: bool
rc_12p()
12-part red candle condition
Returns: bool
rc_13p()
13-part red candle condition
Returns: bool
rc_14p()
14-part red candle condition
Returns: bool
rc_15p()
15-part red candle condition
Returns: bool
rc_16p()
16-part red candle condition
Returns: bool
rc_17p()
17-part red candle condition
Returns: bool
rc_18p()
18-part red candle condition
Returns: bool
rc_19p()
19-part red candle condition
Returns: bool
rc_20p()
20-part red candle condition
Returns: bool
rc_21p()
21-part red candle condition
Returns: bool
rc_22p()
22-part red candle condition
Returns: bool
rc_23p()
23-part red candle condition
Returns: bool
rc_24p()
24-part red candle condition
Returns: bool
rc_25p()
25-part red candle condition
Returns: bool
rc_26p()
26-part red candle condition
Returns: bool
rc_27p()
27-part red candle condition
Returns: bool
rc_28p()
28-part red candle condition
Returns: bool
rc_29p()
29-part red candle condition
Returns: bool
rc_30p()
30-part red candle condition
Returns: bool
cdut()
candle double uptrend condition
Returns: bool
cddt()
candle double downtrend condition
Returns: bool
cdut_1p()
1-part candle double uptrend condition
Returns: bool
cdut_2p()
2-part candle double uptrend condition
Returns: bool
cdut_3p()
3-part candle double uptrend condition
Returns: bool
cdut_4p()
4-part candle double uptrend condition
Returns: bool
cdut_5p()
5-part candle double uptrend condition
Returns: bool
cdut_6p()
6-part candle double uptrend condition
Returns: bool
cdut_7p()
7-part candle double uptrend condition
Returns: bool
cdut_8p()
8-part candle double uptrend condition
Returns: bool
cdut_9p()
9-part candle double uptrend condition
Returns: bool
cdut_10p()
10-part candle double uptrend condition
Returns: bool
cdut_11p()
11-part candle double uptrend condition
Returns: bool
cdut_12p()
12-part candle double uptrend condition
Returns: bool
cdut_13p()
13-part candle double uptrend condition
Returns: bool
cdut_14p()
14-part candle double uptrend condition
Returns: bool
cdut_15p()
15-part candle double uptrend condition
Returns: bool
cdut_16p()
16-part candle double uptrend condition
Returns: bool
cdut_17p()
17-part candle double uptrend condition
Returns: bool
cdut_18p()
18-part candle double uptrend condition
Returns: bool
cdut_19p()
19-part candle double uptrend condition
Returns: bool
cdut_20p()
20-part candle double uptrend condition
Returns: bool
cdut_21p()
21-part candle double uptrend condition
Returns: bool
cdut_22p()
22-part candle double uptrend condition
Returns: bool
cdut_23p()
23-part candle double uptrend condition
Returns: bool
cdut_24p()
24-part candle double uptrend condition
Returns: bool
cdut_25p()
25-part candle double uptrend condition
Returns: bool
cdut_26p()
26-part candle double uptrend condition
Returns: bool
cdut_27p()
27-part candle double uptrend condition
Returns: bool
cdut_28p()
28-part candle double uptrend condition
Returns: bool
cdut_29p()
29-part candle double uptrend condition
Returns: bool
cdut_30p()
30-part candle double uptrend condition
Returns: bool
cddt_1p()
1-part candle double downtrend condition
Returns: bool
cddt_2p()
2-part candle double downtrend condition
Returns: bool
cddt_3p()
3-part candle double downtrend condition
Returns: bool
cddt_4p()
4-part candle double downtrend condition
Returns: bool
cddt_5p()
5-part candle double downtrend condition
Returns: bool
cddt_6p()
6-part candle double downtrend condition
Returns: bool
cddt_7p()
7-part candle double downtrend condition
Returns: bool
cddt_8p()
8-part candle double downtrend condition
Returns: bool
cddt_9p()
9-part candle double downtrend condition
Returns: bool
cddt_10p()
10-part candle double downtrend condition
Returns: bool
cddt_11p()
11-part candle double downtrend condition
Returns: bool
cddt_12p()
12-part candle double downtrend condition
Returns: bool
cddt_13p()
13-part candle double downtrend condition
Returns: bool
cddt_14p()
14-part candle double downtrend condition
Returns: bool
cddt_15p()
15-part candle double downtrend condition
Returns: bool
cddt_16p()
16-part candle double downtrend condition
Returns: bool
cddt_17p()
17-part candle double downtrend condition
Returns: bool
cddt_18p()
18-part candle double downtrend condition
Returns: bool
cddt_19p()
19-part candle double downtrend condition
Returns: bool
cddt_20p()
20-part candle double downtrend condition
Returns: bool
cddt_21p()
21-part candle double downtrend condition
Returns: bool
cddt_22p()
22-part candle double downtrend condition
Returns: bool
cddt_23p()
23-part candle double downtrend condition
Returns: bool
cddt_24p()
24-part candle double downtrend condition
Returns: bool
cddt_25p()
25-part candle double downtrend condition
Returns: bool
cddt_26p()
26-part candle double downtrend condition
Returns: bool
cddt_27p()
27-part candle double downtrend condition
Returns: bool
cddt_28p()
28-part candle double downtrend condition
Returns: bool
cddt_29p()
29-part candle double downtrend condition
Returns: bool
cddt_30p()
30-part candle double downtrend condition
Returns: bool
CandleAnalysisLibrary "CandleAnalysis"
A collection of frequently used candle analysis functions in my scripts.
isBullish(barsBack)
Checks if a specific bar is bullish.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar is bullish, otherwise returns false.
isBearish(barsBack)
Checks if a specific bar is bearish.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar is bearish, otherwise returns false.
isBE(barsBack)
Checks if a specific bar is break even.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar is break even, otherwise returns false.
getBodySize(barsBack, inPriceChg)
Calculates a specific candle's body size.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
inPriceChg (bool) : (bool) True to return the body size as a price change value. The default is false (in points).
Returns: The candle's body size in points.
getTopWickSize(barsBack, inPriceChg)
Calculates a specific candle's top wick size.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
inPriceChg (bool) : (bool) True to return the wick size as a price change value. The default is false (in points).
Returns: The candle's top wick size in points.
getBottomWickSize(barsBack, inPriceChg)
Calculates a specific candle's bottom wick size.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
inPriceChg (bool) : (bool) True to return the wick size as a price change value. The default is false (in points).
Returns: The candle's bottom wick size in points.
getBodyPercent(barsBack)
Calculates a specific candle's body size as a percentage of its entire size including its wicks.
Parameters:
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: The candle's body size percentage.
isHammer(fib, bullish, barsBack)
Checks if a specific bar is a hammer candle based on a given fibonacci level.
Parameters:
fib (float) : (float) The fibonacci level to base candle's body on. The default is 0.382.
bullish (bool) : (bool) True if the candle must to be green. The default is false.
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar matches the requirements of a hammer candle, otherwise returns false.
isShootingStar(fib, bearish, barsBack)
Checks if a specific bar is a shooting star candle based on a given fibonacci level.
Parameters:
fib (float) : (float) The fibonacci level to base candle's body on. The default is 0.382.
bearish (bool) : (bool) True if the candle must to be red. The default is false.
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar matches the requirements of a shooting star candle, otherwise returns false.
isDoji(wickSize, bodySize, barsBack)
Checks if a specific bar is a doji candle based on a given wick and body size.
Parameters:
wickSize (float) : (float) The maximum top wick size compared to the bottom and vice versa. The default is 1.5.
bodySize (float) : (bool) The maximum body size as a percentage compared to the entire candle size. The default is 5.
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar matches the requirements of a doji candle.
isBullishEC(gapTolerance, rejectionWickSize, engulfWick, barsBack)
Checks if a specific bar is a bullish engulfing candle.
Parameters:
gapTolerance (int)
rejectionWickSize (int) : (int) The maximum top wick size compared to the body as a percentage. The default is 10.
engulfWick (bool) : (bool) True if the engulfed candle's wick requires to be engulfed as well. The default is false.
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar matches the requirements of a bullish engulfing candle.
isBearishEC(gapTolerance, rejectionWickSize, engulfWick, barsBack)
Checks if a specific bar is a bearish engulfing candle.
Parameters:
gapTolerance (int)
rejectionWickSize (int) : (int) The maximum bottom wick size compared to the body as a percentage. The default is 10.
engulfWick (bool) : (bool) True if the engulfed candle's wick requires to be engulfed as well. The default is false.
barsBack (int) : (int) The number of bars to look back. The default is 0 (current bar).
Returns: True if the bar matches the requirements of a bearish engulfing candle.