[LIB] Array / Matrix DisplayLibrary "ArrayMatrixHUD"
Show Array or Matrix Elements In Table
For Arrays: Set the number of rows you want the data displayed in and it will generate a table, calculating the columns based on the size of the array being displayed.
For Matrix: It will automatically match the Rows and Columns to the values in the matrix.
Note: On the left, the table shows the index of the array/matrix value starting at 1. So, to call that value from inside the array, subtract 1 from the index value to the left. For matrices, keep in mind that the row and column are also starting at one when trying to call a value from the matrix. The numbering of the values on the left is for display purposes only.
viewArray(_arrayName, _pos, _txtSize, _tRows)
Array Element Display (Supports float, int, string, and bool)
Parameters:
_arrayName : ID of Array to be Displayed
_pos : Position for Table
_txtSize : Size of Table Cell Text
_tRows : Number of Rows to Display Data In (columns will be calculated accordingly)
Returns: A Display of Array Values in a Table
viewMatrix(_matrixName, _pos, _txtSize)
Matrix Element Display (Supports float, int, string, and bool)
Parameters:
_matrixName : ID of Matrix to be Displayed
_pos : Position for Table
_txtSize : Size of Table Cell Text
Returns: A Display of Matrix Values in a Table
Göstergeler ve stratejiler
RecursiveAlertsLibrary "RecursiveAlerts"
The library provides options to run alert() calls in loop without worrying about limitations of frequency options.
When an alert statement is called within a loop,
it will fire just once per bar irrespective of how many iterations allowed when fequency is set to alert.freq_once_per_bar or alert.freq_once_per_bar_close
it will fire continuously till it breaks when frequency is set to alert.freq_all
The function helps overcome this issue by using varip key array which resets on every bar
rAlert(message, key) Enhanced alert which can be used in loops
Parameters:
message : Alert message to be fired
key : Key to be checked to avoid repetitive alerts
Returns: array containing id of already fired alerts
Thanks to @theheirophant, @JohnBaron and @LucF for discussions and suggestion which eventually lead to this solution :)
CarlLibLibrary "CarlLib"
LastLowRedHighGreen(open, close, high, close, reqChangePerc) returns values representing the high of the most recent green and the low of the most recent red
Parameters:
open : open series
close : close series
high : high series
close : close series
reqChangePerc : the minimum require change percentage for the values to switch to new ones.
Returns:
TradingHookLibrary "TradingHook"
This library is a client script for making a webhook signal formatted string to TradingHook webhook server.
buy_message(password, amount, order_name) Make a buy Message for TradingHook.
Parameters:
password : (string) password that you set in .env file.
amount : (float) amount. If not set, your strategy qty will be sent.
order_name : (string) order_name. The default name is "Order".
Returns: (string) A string containing the formatted webhook message.
sell_message(password, percent, order_name) Make a sell message for TradingHook.
Parameters:
password : (string) password that you set in .env file.
percent : (string) what percentage of your quantity you want to sell.
order_name : (string) order_name. The default name is "Order".
Returns: (string) A string containing the formatted webhook message.
You can use TradingHook WebServer open source code in github(github.com)
PlurexSignalIntegrationLibrary "PlurexSignalIntegration"
Provides tools for integrating Strategies and Alerts into plurex.io signals.
plurexMarket() Build a Plurex market from a base and quote asset symbol.
Returns: A market string that can be used in Plurex Signal messages.
tickerToPlurexMarket() Builds simple Plurex market string from the syminfo
Returns: A market string that can be used in Plurex Signal messages.
simpleMessage(secret, action, marketOverride) Builds simple Plurex Signal Messages
Parameters:
secret : The secret for your Signal on plurex
action : The action of the message. One of .
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
executeStrategy(secret, openLong, openShort, closeLongs, closeShorts, marketOverride) Executes strategy actions with Plurex Signal messages
Parameters:
secret : The secret for your Signal on plurex
openLong : Strategy should open long if true, aggregated with other boolean values
openShort : Strategy should open short if true, aggregated with other boolean values
closeLongs : Strategy should close longs if true, aggregated with other boolean values
closeShorts : Strategy should close shorts if true, aggregated with other boolean values
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
fontilabLibrary "fontilab"
Provides function's indicators for pivot - trend - resistance.
pivots(src, lenght, isHigh) Detecting pivot points (and returning price + bar index.
Parameters:
src : The chart we analyse.
lenght : Used for the calcul.
isHigh : lookging for high if true, low otherwise.
Returns: The bar index and the price of the pivot.
calcDevThreshold(tresholdMultiplier, closePrice) Calculate deviation threshold for identifying major swings.
Parameters:
tresholdMultiplier : Usefull to equilibrate the calculate.
closePrice : Close price of the chart wanted.
Returns: The deviation threshold.
calcDev(basePrice, price) Custom function for calculating price deviation for validating large moves.
Parameters:
basePrice : The reference price.
price : The price tested.
Returns: The deviation.
pivotFoundWithLines(dev, isHigh, index, price, dev_threshold, isHighLast, pLast, iLast, lineLast) Detecting pivots that meet our deviation criteria.
Parameters:
dev : The deviation wanted.
isHigh : The type of pivot tested (high or low).
index : The Index of the pivot tested.
price : The chart price wanted.
dev_threshold : The deviation treshold.
isHighLast : The type of last pivot.
pLast : The pivot price last.
iLast : Index of the last pivot.
lineLast : The lst line.
Returns: The Line and bool is pivot High.
getDeviationPivots(thresholdMultiplier, depth, lineLast, isHighLast, iLast, pLast, deleteLines, closePrice, highPrice, lowPrice) Get pivot that meet our deviation criteria.
Parameters:
thresholdMultiplier : The treshold multiplier.
depth : The depth to calculate pivot.
lineLast : The last line.
isHighLast : The type of last pivot
iLast : Index of the last pivot.
pLast : The pivot price last.
deleteLines : If the line are draw or not.
closePrice : The chart close price.
highPrice : The chart high price.
lowPrice : The chart low price.
Returns: All pivot the informations.
getElIntArrayFromEnd() Get the last element of an int array.
getElFloatArrayFromEnd() Get the last element of an float array.
getElBoolArrayFromEnd() Get the last element of a bool array.
isTrendContinuation(isTrendUp, arrayBounds, lastPrice, precision) Check if last price is between bounds array.
Parameters:
isTrendUp : Is actual trend up.
arrayBounds : The trend array.
lastPrice : The pivot Price that just be found.
precision : The percent we add to actual bounds to validate a move.
Returns: na if price is between bounds, true if continuation, false if not.
getTrendPivots(trendBarIndexes, trendPrices, trendPricesIsHigh, interBarIndexes, interPrices, interPricesIsHigh, isTrendHesitate, isTrendUp, trendPrecision, pLast, iLast, isHighLast) Function to update array and trend related to pivot trend interpretation.
Parameters:
trendBarIndexes : The array trend bar index.
trendPrices : The array trend price.
trendPricesIsHigh : The array trend is high.
interBarIndexes : The array inter bar index.
interPrices : The array inter price.
interPricesIsHigh : The array inter ishigh.
isTrendHesitate : The actual status of is trend hesitate.
isTrendUp : The actual status of is trend up.
trendPrecision : The var precision to add in "iscontinuation" function.
pLast : The last pivot price.
iLast : The last pivot bar index.
isHighLast : The last pivot "isHigh".
Returns: trend & inter arrays, is trend hesitate, is trend up.
drawBoundLines(startIndex, startPrice, endIndex, endPrice, breakingPivotIndex, breakingPivotPrice, isTrendUp) Draw bounds and breaking line of the trend.
Parameters:
startIndex : Index of the first bound line.
startPrice : Price of first bound line.
endIndex : Index of second bound line.
endPrice : price of second bound line.
breakingPivotIndex : The breaking line index.
breakingPivotPrice : The breaking line price.
isTrendUp : The actual status of the trend.
Returns: The lines bounds and breaking line.
ColorArrayLibrary "ColorArray"
Simple color array gradient tool.
makeGradient(size, _col1, _col2, _col3, _col4, _col5) Color Gradient Array from 5 colors.
Parameters:
size : : default 10
_col1 : : default #ff0000
_col2 : : default #ffff00
_col3 : : default #00ff00
_col4 : : default #00ffff
_col5 : : default #0000ff
Returns: array of colors to specified size.
WpProbabilisticLibLibrary "WpProbabilisticLib"
Library that contains functions to calculate probabilistic based on historical candle analysis
CandleType(open, close) This function check what type of candle is, based on its close and open prices
Parameters:
open : series float (open price)
close : series float (close price)
Returns: This function return the candle type (1 for Bullish, -1 Bearish, 0 as Doji candle)
CandleTypePercentDiff(open, close, qtd_candles_before, consider_dojis) This function calculates the percentage difference between Bullish and Bearish in a candlestick range back in time and which is the type with the least occurrences
Parameters:
open : series float (open price series)
close : series float (close price series)
qtd_candles_before : simple int (Number of candles before to calculate)
consider_dojis : simple string (How to consider dojis (no consider "NO", as bearish "AS_RED", as bullish "AS_GREEN"))
Returns: tuple(float, int) (Returns the percentage difference between Bullish and Bearish candles and which type of candle has the least occurrences)
external_input_utilsLibrary "external_input_utils"
Collection of external input utilities for conversion and other hacky functions
str_to_src(value) str_to_src - Convert the string value to the coresponding source series. It can be used to limit the "input.source" choices provided to the end user.
The most interesting part is that it can be used to overcome the "one input.source call limitation" for external inputs to your script
Parameters:
value : - The string equivalent to the source to be converted
Returns: series of the coresponding source
eval_cond(input, operator, value, defval) eval_cond - Evaluate the condition given an operator
Parameters:
input : - The input to be compared with. It can be an external input or a regular one
operator : - The string operator that describe the coparison operation
value : - The value to compare with the input. This can be a serries or a constant
defval : - The boolean value to return when 'noop' is selected
Returns: series of bool the result of the operation evaluation
Price Displacement - Candlestick (OHLC) CalculationsA Magical little helper friend for Candle Math.
When composing scripts, it is often necessary to manipulate the math around the OHLC. At times, you want a scalar (absolute) value others you want a vector (+/-). Sometimes you want the open - close and sometimes you want just the positive number of the body size. You might want it in ticks or you might want it in points or you might want in percentages. And every time you try to put it together you waste precious time and brain power trying to think about how to properly structure what you're looking for. Not to mention it's normally not that aesthetically pleasing to look at in the code.
So, this fixes all of that.
Using this library. A function like 'pd.pt(_exp)' can call any kind of candlestick math you need. The function returns the candlestick math you define using particular expressions.
Candle Math Functions Include:
Points:
pt(_exp) Absolute Point Displacement. Point quantity of given size parameters according to _exp.
vpt(_exp) Vector Point Displacement. Point quantity of given size parameters according to _exp.
Ticks:
tick(_exp) Absolute Tick Displacement. Tick quantity of given size parameters according to _exp.
vtick(_exp) Vector Tick Displacement. Tick quantity of given size parameters according to _exp.
Percentages:
pct(_exp, _prec) Absolute Percent Displacement. (w/rounding overload). Percent quantity of bar range of given size parameters according to _exp.
vpct(_exp, _prec) Vector Percent Displacement (w/rounding overload). Percent quantity of bar range of given size parameters according to _exp.
Expressions You Can Use with Formulas:
The expressions are simple (simple strings that is) and I did my best to make them sensible, generally using just the ohlc abreviations. I also included uw, lw, bd, and rg for when you're just trying to pull a candle component out. That way you don't have to think about which of the ohlc you're trying to get just use pd.tick("uw") and now the variable is assigned the length of the upper wick, absolute value, in ticks. If you wanted the vector in pts its pd.vpt("uw"). It also makes changing things easy too as I write it out.
Expression List:
Combinations
"oh" = open - high
"ol" = open - low
"oc" = open - close
"ho" = high - open
"hl" = high - low
"hc" = high - close
"lo" = low - open
"lh" = low - high
"lc" = low - close
"co" = close - open
"ch" = close - high
"cl" = close - low
Candle Components
"uw" = Upper Wick
"bd" = Body
"lw" = Lower Wick
"rg" = Range
Pct() Only
"scp" = Scalar Close Position
"sop" = Scalar Open Position
"vcp" = Vector Close Position
"vop" = Vector Open Position
The attributes are going to be available in the pop up dialogue when you mouse over the function, so you don't really have to remember them. I tried to make that look as efficient as possible. You'll notice it follows the OHLC pattern. Thus, "oh" precedes "ho" (heyo) because "O" would be first in the OHLC. Its a way to help find the expression you're looking for quickly. Like looking through an alphabetized list for traders.
There is a copy/paste console friendly helper list in the script itself.
Additional Notes on the Pct() Only functions:
This is the original reason I started writing this. These concepts place a rating/value on the bar based on candle attributes in one number. These formulas put a open or close value in a percentile of the bar relative to another aspect of the bar.
Scalar - Non-directional. Absolute Value.
Scalar Position: The position of the price attribute relative to the scale of the bar range (high - low)
Example: high = 100. low = 0. close = 25.
(A) Measure price distance C-L. How high above the low did the candle close (e.g. close - low = 25)
(B) Divide by bar range (high - low). 25 / (100 - 0) = .25
Explaination: The candle closed at the 25th percentile of the bar range given the bar range low = 0 and bar range high = 100.
Formula: scp = (close - low) / (high - low)
Vector = Directional.
Vector Position: The position of the price attribute relative to the scale of the bar midpoint (Vector Position at hl2 = 0)
Example: high = 100. low = 0. close = 25.
(A) Measure Price distance C-L: How high above the low did the candle close (e.g. close - low = 25)
(B) Measure Price distance H-C: How far below the high did the candle close (e.g. high - close = 75)
(C) Take Difference: A - B = C = -50
(D) Divide by bar range (high - low). -50 / (100 - 0) = -0.50
Explaination: Candle close at the midpoint between hl2 and the low.
Formula: vcp = { / (high - low) }
Thank you for checking this out. I hope no one else has already done this (because it took half the day) and I hope you find value in it. Be well. Trade well.
Library "PD"
Price Displacement
pt(_exp) Absolute Point Displacement. Point quantity of given size parameters according to _exp.
Parameters:
_exp : (string) Price Parameter
Returns: Point size of given expression as an absolute value.
vpt(_exp) Vector Point Displacement. Point quantity of given size parameters according to _exp.
Parameters:
_exp : (string) Price Parameter
Returns: Point size of given expression as a vector.
tick(_exp) Absolute Tick Displacement. Tick quantity of given size parameters according to _exp.
Parameters:
_exp : (string) Price Parameter
Returns: Tick size of given expression as an absolute value.
vtick(_exp) Vector Tick Displacement. Tick quantity of given size parameters according to _exp.
Parameters:
_exp : (string) Price Parameter
Returns: Tick size of given expression as a vector.
pct(_exp, _prec) Absolute Percent Displacement (w/rounding overload). Percent quantity of bar range of given size parameters according to _exp.
Parameters:
_exp : (string) Expression
_prec : (int) Overload - Place value precision definition
Returns: Percent size of given expression as decimal.
vpct(_exp, _prec) Vector Percent Displacement (w/rounding overload). Percent quantity of bar range of given size parameters according to _exp.
Parameters:
_exp : (string) Expression
_prec : (int) Overload - Place value precision definition
Returns: Percent size of given expression as decimal.
SizeAndPlaceLibrary "SizeAndPlace"
size and location shortcuts
posYtoInt(string) posYtoInt as titled..
Parameters:
string : _inp
posXtoInt(string) posXtoInt as titled..
Parameters:
string : _inp
sizeToInt(string) sizeToInt as titled..
Parameters:
string : size
sizeToString(int) sizeToString as titled..
Parameters:
int : size
sizeStringToSize(string) sizeStringToSize as titled..
Parameters:
string : size
locationIntToStr(int) locationIntToStr as titled..
Parameters:
int : inp
locStringToLoc(string) locStringToLoc as titled..
Parameters:
string : location
posIntToString(int, int) posIntToString as titled..
Parameters:
int : _x
int : _y
PivotThis library was designed to create three different datasets using Bill Williams fractals. The goal is to spot trends in reversal data and ultimately use these datasets to help predict future price reversals.
First, the pivot() function is used to initialize and populate three separate arrays (high pivot , low pivot , all pivots ). Since each high/low price depends on the bar_index, the bar_index, pivot direction(high/low), and high/low values are compressed into a string to maintain the data's integrity ("__"). Once each string array is populated and organized by bar_index, all three are returned inside a tuple. The return value must be deconstructed H,L,A =pivot() for each array's values to be accessed using getPivot() . This boilerplate allows for data to be accessed more efficiently in a recursive environment. getPivot() was designed to be used inside of a for or while block to populate matrices for further analyses. Again, getPivot() return values must be exposed through deconstruction. x,d,y =getPivot(). See code for more details.
pivot(int XLR) initializes and populates arrays
Parameters
XLR - number of bars to the left and right that must be lower for a high to be considered a pivotHigh, or vice versa. This number will drastically change the size and scope of the returned datasets. smaller values will produce much larger datasets, which might model short term price activity well. In contrast, larger values will produce smaller datasets which might model longer term price activity well.
Returns - tuple [string ]
getPivot(string arrayID, int index) accesses array data
Parameters
arrayID - the variable name for one of the three arrays returned by pivot().
index - the index of the provided array, with 0 being the most recent pivot point. can be set to " i " in a loop to access values recursively
Returns - tuple
Strategy Table LibraryLibrary "table_library"
TODO: With this library, you can add tables to your strategies.
strategy_table()
Returns: Strategy Profit Table
Adds a table to the graph of the strategy for which you are calling the function. You can see data such as net profit in this table.
No parameters. Just call the function inside the strategy.
Example Code :
import only_fibonacci/table_lib/1 as st
st.strategy_table()
Time█ OVERVIEW
This library is a Pine Script™ programmer’s tool containing a variety of time related functions to calculate or measure time, or format time into string variables.
█ CONCEPTS
`formattedTime()`, `formattedDate()` and `formattedDay()`
Pine Script™, like many other programming languages, uses timestamps in UNIX format, expressed as the number of milliseconds elapsed since 00:00:00 UTC, 1 January 1970. These three functions convert a UNIX timestamp to a formatted string for human consumption.
These are examples of ways you can call the functions, and the ensuing results:
CODE RESULT
formattedTime(timenow) >>> "00:40:35"
formattedTime(timenow, "short") >>> "12:40 AM"
formattedTime(timenow, "full") >>> "12:40:35 AM UTC"
formattedTime(1000 * 60 * 60 * 3.5, "HH:mm") >>> "03:30"
formattedDate(timenow, "short") >>> "4/30/22"
formattedDate(timenow, "medium") >>> "Apr 30, 2022"
formattedDate(timenow, "full") >>> "Saturday, April 30, 2022"
formattedDay(timenow, "E") >>> "Sat"
formattedDay(timenow, "dd.MM.yy") >>> "30.04.22"
formattedDay(timenow, "yyyy.MM.dd G 'at' hh:mm:ss z") >>> "2022.04.30 AD at 12:40:35 UTC"
These functions use str.format() and some of the special formatting codes it allows for. Pine Script™ documentation does not yet contain complete specifications on these codes, but in the meantime you can find some information in the The Java™ Tutorials and in Java documentation of its MessageFormat class . Note that str.format() implements only a subset of the MessageFormat features in Java.
`secondsSince()`
The introduction of varip variables in Pine Script™ has made it possible to track the time for which a condition is true when a script is executing on a realtime bar. One obvious use case that comes to mind is to enable trades to exit only when the exit condition has been true for a period of time, whether that period is shorter that the chart's timeframe, or spans across multiple realtime bars.
For more information on this function and varip please see our Using `varip` variables publication.
`timeFrom( )`
When plotting lines , boxes , and labels one often needs to calculate an offset for past or future end points relative to the time a condition or point occurs in history. Using xloc.bar_index is often the easiest solution, but some situations require the use of xloc.bar_time . We introduce `timeFrom()` to assist in calculating time-based offsets. The function calculates a timestamp using a negative (into the past) or positive (into the future) offset from the current bar's starting or closing time, or from the current time of day. The offset can be expressed in units of chart timeframe, or in seconds, minutes, hours, days, months or years. This function was ported from our Time Offset Calculation Framework .
`formattedNoOfPeriods()` and `secondsToTfString()`
Our final two offerings aim to confront two remaining issues:
How much time is represented in a given timestamp?
How can I produce a "simple string" timeframe usable with request.security() from a timeframe expressed in seconds?
`formattedNoOfPeriods()` converts a time value in ms to a quantity of time units. This is useful for calculating a difference in time between 2 points and converting to a desired number of units of time. If no unit is supplied, the function automatically chooses a unit based on a predetermined time step.
`secondsToTfString()` converts an input time in seconds to a target timeframe string in timeframe.period string format. This is useful for implementing stepped timeframes relative to the chart time, or calculating multiples of a given chart timeframe. Results from this function are in simple form, which means they are useable as `timeframe` arguments in functions like request.security() .
█ NOTES
Although the example code is commented in detail, the size of the library justifies some further explanation as many concepts are demonstrated. Key points are as follows:
• Pivot points are used to draw lines from. `timeFrom( )` calculates the length of the lines in the specified unit of time.
By default the script uses 20 units of the charts timeframe. Example: a 1hr chart has arrows 20 hours in length.
• At the point of the arrows `formattedNoOfPeriods()` calculates the line length in the specified unit of time from the input menu.
If “Use Input Time” is disabled, a unit of time is automatically assigned.
• At each pivot point a label with a formatted date or time is placed with one of the three formatting helper functions to display the time or date the pivot occurred.
• A label on the last bar showcases `secondsSince()` . The label goes through three stages of detection for a timed alert.
If the difference between the high and the open in ticks exceeds the input value, a timer starts and will turn the label red once the input time is exceeded to simulate a time-delayed alert.
• In the bottom right of the screen `secondsToTfString()` posts the chart timeframe in a table. This can be multiplied from the input menu.
Look first. Then leap.
█ FUNCTIONS
formattedTime(timeInMs, format)
Converts a UNIX timestamp (in milliseconds) to a formatted time string.
Parameters:
timeInMs : (series float) Timestamp to be formatted.
format : (series string) Format for the time. Optional. The default value is "HH:mm:ss".
Returns: (string) A string containing the formatted time.
formattedDate(timeInMs, format)
Converts a UNIX timestamp (in milliseconds) to a formatted date string.
Parameters:
timeInMs : (series float) Timestamp to be formatted.
format : (series string) Format for the date. Optional. The default value is "yyyy-MM-dd".
Returns: (string) A string containing the formatted date.
formattedDay(timeInMs, format)
Converts a UNIX timestamp (in milliseconds) to the name of the day of the week.
Parameters:
timeInMs : (series float) Timestamp to be formatted.
format : (series string) Format for the day of the week. Optional. The default value is "EEEE" (complete day name).
Returns: (string) A string containing the day of the week.
secondsSince(cond, resetCond)
The duration in milliseconds that a condition has been true.
Parameters:
cond : (series bool) Condition to time.
resetCond : (series bool) When `true`, the duration resets.
Returns: The duration in seconds for which `cond` is continuously true.
timeFrom(from, qty, units)
Calculates a +/- time offset in variable units from the current bar's time or from the current time.
Parameters:
from : (series string) Starting time from where the offset is calculated: "bar" to start from the bar's starting time, "close" to start from the bar's closing time, "now" to start from the current time.
qty : (series int) The +/- qty of units of offset required. A "series float" can be used but it will be cast to a "series int".
units : (series string) String containing one of the seven allowed time units: "chart" (chart's timeframe), "seconds", "minutes", "hours", "days", "months", "years".
Returns: (int) The resultant time offset `from` the `qty` of time in the specified `units`.
formattedNoOfPeriods(ms, unit)
Converts a time value in ms to a quantity of time units.
Parameters:
ms : (series int) Value of time to be formatted.
unit : (series string) The target unit of time measurement. Options are "seconds", "minutes", "hours", "days", "weeks", "months". If not used one will be automatically assigned.
Returns: (string) A formatted string from the number of `ms` in the specified `unit` of time measurement
secondsToTfString(tfInSeconds, mult)
Convert an input time in seconds to target string TF in `timeframe.period` string format.
Parameters:
tfInSeconds : (simple int) a timeframe in seconds to convert to a string.
mult : (simple float) Multiple of `tfInSeconds` to be calculated. Optional. 1 (no multiplier) is default.
Returns: (string) The `tfInSeconds` in `timeframe.period` format usable with `request.security()`.
HTV_LibraryLibrary "HTV_LibraryV2"
up_bar() 'up_bar' checks true for every candle that closed above open price.
Returns: custom Series Bool
last_up_bar() 'last_up_bar' checks true for every last candle that closed above open price.
Returns: custom Series Bool
down_bar() 'down_bar' checks true for every candle that closed below open price.
Returns: custom Series Bool
last_down_bar() 'last_down_bar' checks true for every last candle that closed below open price.
Returns: custom Series Bool
TBR_Up() 'TBR_Up' checks true for every last confirmed 2 Bar Reversal.
Returns: custom Series Bool
TBR_Down() 'TBR_Down' checks true for every last confirmed 2 Bar Reversal.
Returns: custom Series Bool
TCR_Up() 'TCR_Up' checks true for every last confirmed 3 Candle Reversal.
Returns: custom Series Bool
TCR_Down() 'TCR_Down' checks true for every last confirmed 3 Candle Reversal.
Returns: custom Series Bool
f_fib() 'f_fib' gives a fibonacci number based on rising numericial order starting from 0
Returns: custom Series Bool
WHITE() uses color.rgb(r,g,b,t) function
Returns: literal color
WHITE_25T()
WHITE_50T()
WHITE_90T()
BLACK()
BLACK_25T()
BLACK_50T()
BLACK_90T()
RED()
RED_25T()
RED_50T()
RED_90T()
GREEN()
GREEN_25T()
GREEN_50T()
GREEN_90T()
BLUE()
BLUE_25T()
BLUE_50T()
BLUE_90T()
GREY()
GREY_25T()
GREY_50T()
GREY_90T()
NEON_YELLOW()
NEON_YELLOW_25T()
NEON_YELLOW_50T()
NEON_YELLOW_90T()
NEON_GREEN()
NEON_GREEN_25T()
NEON_GREEN_50T()
NEON_GREEN_90T()
NEON_PINK()
NEON_PINK_25T()
NEON_PINK_50T()
NEON_PINK_90T()
PURPLE()
PURPLE_25T()
PURPLE_50T()
PURPLE_90T()
SMA()
EMA()
WMA()
VWMA()
RMA()
HMA()
STMA()
ETMA()
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
ADX FunctionsLibrary "ADX"
adx(dilen, adxLen)
Parameters:
dilen : Length of the Directional Index.
adxLen : Length (smoothing) of the Average Directional Index.
Returns:
honest personal libraryLibrary "honestpersonallibrary"
thestratnumber() this will return the number 1,2 or 3 using the logic from Rob Smiths #thestrat which uses these type of bars for setups
getBodySize() Gets the current candle's body size (in POINTS, divide by 10 to get pips)
Returns: The current candle's body size in POINTS
getTopWickSize() Gets the current candle's top wick size (in POINTS, divide by 10 to get pips)
Returns: The current candle's top wick size in POINTS
getBottomWickSize() Gets the current candle's bottom wick size (in POINTS, divide by 10 to get pips)
Returns: The current candle's bottom wick size in POINTS
getBodyPercent() Gets the current candle's body size as a percentage of its entire size including its wicks
Returns: The current candle's body size percentage
strictBearPinBar(float, float) This it to find pinbars with a very long wick compared to the body that are bearish
Parameters:
float : minTopMulitplier (default=4) The minimum number of times that the top wick has to be bigger than the candle body size
float : maxBottomMultiplier (default=2) The maximum number of times that the bottom wick can be bigger than the candle body size
Returns: a bool function true if current candle is withing the parameters
strictBullPinBar(float, float) This it to find pinbars with a very long wick compared to the body that are bearish
Parameters:
float : minTopMulitplier (default=4) The minimum number of times that the top wick has to be bigger than the candle body size
float : maxBottomMultiplier (default=2) The maximum number of times that the bottom wick can be bigger than the candle body size
Returns: a bool function true if current candle is withing the parameters
FunctionIntrabarCrossValueLibrary "FunctionIntrabarCrossValue"
intrabar_cross_value(a, b, step) Find the minimum difference of a intrabar cross and return its median value.
Parameters:
a : float, series a.
b : float, series b.
step : float, step to iterate x axis, default=0.01
Returns: float
BitcoinHalvingLibrary "BitcoinHalving"
Displays where Bitcoin's halvings have been
getDates() List of Bitcoin halving dates
Returns: array with timestamp dates
isHalvingDay() Checks if the current day is a halving day
Returns: bool
matrixautotableLibrary "matrixautotable"
Automatic Table from Matrixes with pseudo correction for na values and default color override for missing values. uses overloads in cases of cheap float only, with additional addon for strings next, then cell colors, then text colors, and tooltips last.. basic size and location are auto, include the template to speed this up...
TODO : make bools version
var string group_table = ' Table'
var int _tblssizedemo = input.int ( 10 )
string tableYpos = input.string ( 'middle' , '↕' , inline = 'place' , group = group_table, options= )
string tableXpos = input.string ( 'center' , '↔' , inline = 'place' , group = group_table, options= , tooltip='Position on the chart.')
int _textSize = input.int ( 1 , 'Table Text Size' , inline = 'place' , group = group_table)
var matrix _floatmatrix = matrix.new (_tblssizedemo, _tblssizedemo, 0 )
var matrix _stringmatrix = matrix.new (_tblssizedemo, _tblssizedemo, 'test' )
var matrix _bgcolormatrix = matrix.new (_tblssizedemo, _tblssizedemo, color.white )
var matrix _textcolormatrix = matrix.new (_tblssizedemo, _tblssizedemo, color.black )
var matrix _tooltipmatrix = matrix.new (_tblssizedemo, _tblssizedemo, 'tool' )
// basic table ready to go with the aboec matrixes (replace in your code)
// for demo purpose, random colors, random nums, random na vals
if barstate.islast
varip _xsize = matrix.rows (_floatmatrix) -1
varip _ysize = matrix.columns (_floatmatrix) -1
for _xis = 0 to _xsize -1 by 1
for _yis = 0 to _ysize -1 by 1
_randomr = int(math.random(50,250))
_randomg = int(math.random(50,250))
_randomb = int(math.random(50,250))
_randomt = int(math.random(10,90 ))
bgcolor = color.rgb(250 - _randomr, 250 - _randomg, 250 - _randomb, 100 - _randomt )
txtcolor = color.rgb(_randomr, _randomg, _randomb, _randomt )
matrix.set(_bgcolormatrix ,_yis,_xis, bgcolor )
matrix.set(_textcolormatrix ,_yis,_xis, txtcolor)
matrix.set(_floatmatrix ,_yis,_xis, _randomr)
// random na
_ymiss = math.floor(math.random(0, _yis))
_xmiss = math.floor(math.random(0, _xis))
matrix.set( _floatmatrix ,_ymiss, _xis, na)
matrix.set( _stringmatrix ,_ymiss, _xis, na)
matrix.set( _bgcolormatrix ,_ymiss, _xis, na)
matrix.set( _textcolormatrix ,_ymiss, _xis, na)
matrix.set( _tooltipmatrix ,_ymiss, _xis, na)
// import here
import kaigouthro/matrixautotable/1 as mtxtbl
// and render table..
mtxtbl.matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _textcolormatrix, _tooltipmatrix, _textSize ,tableYpos ,tableXpos)
matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _textcolormatrix, _tooltipmatrix, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_bgcolormatrix : color
_textcolormatrix : color
_tooltipmatrix : string
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _textcolormatrix, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_bgcolormatrix : color
_textcolormatrix : color
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _txtdefcol, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_bgcolormatrix : color
_txtdefcol : color
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _stringmatrix, _txtdefcol, _bgdefcol, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_txtdefcol : color
_bgdefcol : color
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _txtdefcol, _bgdefcol, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_txtdefcol : color
_bgdefcol : color
_textSize : int
tableYpos : string
tableXpos : string