BasicVisibleChartBasic library for the visible range chart; with functions to allow plotting Fibs from body high/low as well as wick high/low
-Thanks to code from @PineCoders Visible Chart library (PineCoders/VisibleChart/4), which is a much more comprehensive library than this, but which does not include some functions that I find useful:
-Added the following exportable functions: highest/lowest body, highest/lowest close, highest/lowest open. These allow one to anchor fibs from bodies rather than wicks
-Added a Fib Box function in the example code
The above chart shows the example code plotting a Fib range drawn from bodies and a highlighted retracement zone (61.8 % - 78.6% )
~~All Exportable Functions~~
barIsVisible()
highestClose()
highestOpen()
highestBody()
lowestClose()
lowestOpen()
lowestBody()
high()
highBarTime()
low()
lowBarTime()
open()
close()
Trend Analysis
lib_hlmLibrary "lib_hlm"
Ichimoku trend line and plotting tools.
HLM(Period)
Optionless Ichimoku/Donchian trend line calculation.
Parameters:
Period : The period for the trend line calculation.
Returns: The midpoint of the highest high and the lowest low.
HLM_Offset(offset, currentIsZero, intoPast)
Standardized language for plotting offsets.
Parameters:
offset : The offset number to use.
currentIsZero : `true` for ichimoku counting. `false` for natural language
intoPast : `true` if projecting backwards. `false` if projecting forwards.
Returns: The offset adjusted by counting style and direction.
TK()
Calculates the Ichimoku Tenkan and Kijun lines.
Returns: {tenkan, kijun}
SenkouSpans(period_1, period_2, period_3)
Calculates the Ichimoku Senkou Span A and Senkou Span B values.
Parameters:
period_1 : default=9
period_2 : default=26
period_3 : default=52
Returns: {senkou_a, senkou_b}
Ichimoku_Cloud(period_1, period_2, period_3)
Calculate the Ichimoku cloud value and offsets.
Parameters:
period_1 : default=9
period_2 : default=26
period_3 : default=52
Returns: {senkou_a, senkou_b, cloud_offset}
Chikou_Span()
Gets the chikou span and offsets.
Returns: {chikou, chikou_offset}
Ichimoku(enabled)
Get the values for the full, default Ichimoku system, including plotting offsets. Common toggle for all values.
Parameters:
enabled : `true` will return plottable values. `false` will return only na's (turns off plotting).
Returns: {tenkan, kijun, senkou_a, senkou_b, cloud_offset, chikou, chikou_offset}
Ichimoku_Line_Colors()
Get a set of colors with a common transparency for Ichimoku.
Returns: {tenkan_color, kijun_color, senkou_a_color, senkou_b_color, chikou_color}
Ichimoku_Cloud_Color()
Determines the cloud color and applies transparency (Ichimoku).
Returns: the dominant lines color with applied transparency
Ichimoku_Colors()
Gets a full set of default ichimoku colors with cloud color based on the input senkou values.
Returns: {tenkan_color, kijun_color, senkou_a_color, senkou_b_color, chikou_color, cloud_color}
AutoFiboRetraceLibrary "AutoFiboRetrace"
TODO: add library description here
fun(x) TODO: add function description here
Parameters:
x : TODO: add parameter x description here
Returns: TODO: add what function returns
merge_pinbarLibrary "merge_pinbar"
merge_pinbar: merge bars and check whether the bar is a pinbar
merge_pinbar(simple, simple) merge_pinbar: merge bars and check whether the bar is a pinbar
Parameters:
simple : int period: the statistic bar period
simple : int max_bars: the max bars to be merged
Returns: array:
PivotPointsDailyTraditionalLibrary "PivotPointsDailyTraditional"
Provides the traditional daily pivot values and a pivot vacinity function.
P(level, daysPrior) Returns the P value.
Parameters:
level : The level to caclulate.
daysPrior : The number of days in the past to do the calculation.
R(level, daysPrior) Calculates the R value for a given pivot level.
Parameters:
level : The level to caclulate.
daysPrior : The number of days in the past to do the calculation.
S(level, daysPrior) Calculates the S value for a given pivot level.
Parameters:
level : The level to caclulate.
daysPrior : The number of days in the past to do the calculation.
vacinity(value, daysPrior, maxLevel) Returns a value representing where the provided value is in relation to each pivot level.
Parameters:
value : The value to compare against.
daysPrior : The number of days in the past to do the calculation.
maxLevel : The maximum number of pivot levels to include.
CandleEvaluationLibrary "CandleEvaluation"
Contains functions to evaluate bullish and bearish, engulfing, and outsized candles. They are different from the built-in indicators from TradingView in that these functions don't evaluate classical patterns composed of multiple candles, and they reflect my own understanding of what is "bullish" and bearish", "engulfing", and "outsized".
isBullishBearishCandle()
Determines if the current candle is bullish or bearish according to the length of the wicks and the open and close.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
returns Two values, true or false, for whether it's a bullish or bearish candle respectively.
isTripleBull()
Tells you whether a candle is a "Triple Bull" - that is, one which is bullish in three ways:
It closes higher than it opens
It closes higher than the body of the previous candle
The High is above the High of the previous candle.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
returns True or false.
isTripleBear()
Tells you whether a candle is a "Triple Bear" - that is, one which is bearish in three ways:
It closes lower than it opens
It closes lower than the body of the previous candle
The Low is below the Low of the previous candle.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
returns True or false.
isBigBody()
Tells you if the current candle has a larger than average body size.
int _length - The length of the sma to calculate the average
float _percent - The percentage of the average that the candle body has to be to count as "big". E.g. 100 means it has to be just larger than the average, 200 means it has to be twice as large.
returns True or false
isBullishEngulfing()
Tells you if the current candle is a bullish engulfing candle.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
int _atrFraction The denominator for the ATR fraction, which is the small amount by which the open can be different from the previous close.
returns True or false
isBearishEngulfing()
Tells you if the current candle is a bearish engulfing candle.
int _barsBack How many bars back is the candle you want to evaluate. By default this is 0, i.e., the current bar.
int _atrFraction The denominator for the ATR fraction, which is the small amount by which the open can be different from the previous close.
returns True or false
CreateAndShowZigzagLibrary "CreateAndShowZigzag"
Functions in this library creates/updates zigzag array and shows the zigzag
getZigzag(zigzag, prd, max_array_size) calculates zigzag using period
Parameters:
zigzag : is the float array for the zigzag (should be defined like "var zigzag = array.new_float(0)"). each zigzag points contains 2 element: 1. price level of the zz point 2. bar_index of the zz point
prd : is the length to calculate zigzag waves by highest(prd)/lowest(prd)
max_array_size : is the maximum number of elements in zigzag, keep in mind each zigzag point contains 2 elements, so for example if it's 10 then zigzag has 10/2 => 5 zigzag points
Returns: dir that is the current direction of the zigzag
showZigzag(zigzag, oldzigzag, dir, upcol, dncol) this function shows zigzag
Parameters:
zigzag : is the float array for the zigzag (should be defined like "var zigzag = array.new_float(0)"). each zigzag points contains 2 element: 1. price level of the zz point 2. bar_index of the zz point
oldzigzag : is the float array for the zigzag, you get copy the zigzag array to oldzigzag by "oldzigzag = array.copy(zigzay)" before calling get_zigzag() function
dir : is the direction of the zigzag wave
upcol : is the color of the line if zigzag direction is up
dncol : is the color of the line if zigzag direction is down
Returns: null