DRKMetricsLibrary "DRKMetrics"
TODO: add library description here
curve(disp_ind)
Call function to get a certain curve of your strategy.
Parameters:
disp_ind (string)
Returns: Returns type of curve plot.
cleaner(disp_ind, plot)
Call function to filter out your Strategy plots
Parameters:
disp_ind (string)
plot (float)
cobraTable(option, position)
Assign this function to a random variable to get the "Performance Table"
Parameters:
option (simple string)
position (simple string)
Display
UtilityLibrary "Utility"
A utility library for various trading tools such as signal generation, custom indicators, and multi-condition crossovers.
multiCrossover(source1, source2, threshold1, threshold2)
multiCrossover
@description Detects multi-condition crossovers between two sources with threshold filters.
Parameters:
source1 (float) : The first data series to compare.
source2 (float) : The second data series to compare.
threshold1 (float) : A value that source1 must exceed to trigger the crossover.
threshold2 (float) : A value that source2 must exceed to trigger the crossunder.
Returns: A tuple: (crossUp, crossDown) where crossUp is a boolean for upward crossover, and crossDown is for downward crossover.
macdCustom(source, fastLength, slowLength, signalLength, macdThresh)
macdCustom
@description Calculates custom MACD signals based on thresholds.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA.
slowLength (simple int) : The length of the slow EMA.
signalLength (simple int) : The signal line length.
macdThresh (float) : A threshold for the MACD line to confirm buy/sell signals.
Returns: A tuple: (macdBuySignal, macdSellSignal) where macdBuySignal is true when MACD crosses above, and macdSellSignal is true when MACD crosses below the signal line.
combinedMacdRsi(source, fastLength, slowLength, signalLength, rsiLength, macdThresh, rsiThresh)
combinedMacdRsi
@description Generates combined signals from MACD and RSI indicators.
Parameters:
source (float) : The price data or input series.
fastLength (simple int) : The length of the fast EMA for MACD.
slowLength (simple int) : The length of the slow EMA for MACD.
signalLength (simple int) : The signal line length for MACD.
rsiLength (simple int) : The length of the RSI calculation.
macdThresh (float) : The threshold for MACD signals.
rsiThresh (float) : The threshold for RSI signals.
Returns: A tuple: (buySignal, sellSignal) where buySignal is generated when MACD is positive and RSI is below the threshold, and sellSignal when MACD is negative and RSI is above the threshold.
movingAverageCrossover(source, shortLength, longLength)
movingAverageCrossover
@description Detects crossovers between short-term and long-term moving averages.
Parameters:
source (float) : The price data or input series.
shortLength (int) : The length of the short-term moving average.
longLength (int) : The length of the long-term moving average.
Returns: A tuple: (crossUp, crossDown) where crossUp is true when the short-term MA crosses above the long-term MA, and crossDown when the reverse occurs.
Autotable█ OVERVIEW
The library allows to automatically draw a table based on a string or float matrix (or both) controlling all of the parameters of the table (including merging cells) with parameter matrices (like, e.g. matrix of cell colors).
All things you would normally do with table.new() and table.cell() are now possible using respective parameters of library's main function, autotable() (as explained further below).
Headers can be supplied as arrays.
Merging of the cells is controlled with a special matrix of "L" and "U" values which instruct a cell to merged with the cell to the left or upwards (please see examples in the script and in this description).
█ USAGE EXAMPLES
The simplest and most straightforward:
mxF = matrix.new(3,3, 3.14)
mxF.autotable(bgcolor = color.rgb(249, 209, 29)) // displays float matrix as a table in the top right corner with defalult settings
mxS = matrix.new(3,3,"PI")
// displays string matrix as a table in the top right corner with defalult settings
mxS.autotable(Ypos = "bottom", Xpos = "right", bgcolor = #b4d400)
// displays matrix displaying a string value over a float value in each cell
mxS.autotable(mxF, Ypos = "middle", Xpos = "center", bgcolor = color.gray, text_color = #86f62a)
Draws this:
Tables with headers:
if barstate.islast
mxF = matrix.new(3,3, 3.14)
mxS = matrix.new(3,3,"PI")
arColHeaders = array.from("Col1", "Col2", "Col3")
arRowHeaders = array.from("Row1", "Row2", "Row3")
// float matrix with col headers
mxF.autotable(
bgcolor = #fdfd6b
, arColHeaders = arColHeaders
)
// string matrix with row headers
mxS.autotable(arRowHeaders = arRowHeaders, Ypos = "bottom", Xpos = "right", bgcolor = #b4d400)
// string/float matrix with both row and column headers
mxS.autotable(mxF
, Ypos = "middle", Xpos = "center"
, arRowHeaders = arRowHeaders
, arColHeaders = arColHeaders
, cornerBgClr = #707070, cornerTitle = "Corner cell", cornerTxtClr = #ffdc13
, bgcolor = color.gray, text_color = #86f62a
)
Draws this:
█ FUNCTIONS
One main function is autotable() which has only one required argument mxValS, a string matrix.
Please see below the description of all of the function parameters:
The table:
tbl (table) (Optional) If supplied, this table will be deleted.
The data:
mxValS (matrix ) (Required) Cell text values
mxValF (matrix) (Optional) Numerical part of cell text values. Is concatenated to the mxValS values via `string_float_separator` string (default " ")
Table properties, have same effect as in table.new() :
defaultBgColor (color) (Optional) bgcolor to be used if mxBgColor is not supplied
Ypos (string) (Optional) "top", "bottom" or "center"
Xpos (string) (Optional) "left", "right", or "center"
frame_color (color) (Optional) frame_color like in table.new()
frame_width (int) (Optional) frame_width like in table.new()
border_color (color) (Optional) border_color like in table.new()
border_width (int) (Optional) border_width like in table.new()
force_overlay (simple bool) (Optional) If true draws table on main pane.
Cell parameters, have same effect as in table.cell() ):
mxBgColor (matrix) (Optional) like bgcolor argument in table.cell()
mxTextColor (matrix) (Optional) like text_color argument in table.cell()
mxTt (matrix) (Optional) like tooltip argument in table.cell()
mxWidth (matrix) (Optional) like width argument in table.cell()
mxHeight (matrix) (Optional) like height argument in table.cell()
mxHalign (matrix) (Optional) like text_halign argument in table.cell()
mxValign (matrix) (Optional) like text_valign argument in table.cell()
mxTextSize (matrix) (Optional) like text_size argument in table.cell()
mxFontFamily (matrix) (Optional) like text_font_family argument in table.cell()
Other table properties:
tableWidth (float) (Optional) Overrides table width if cell widths are non zero. E.g. if there are four columns and cell widths are 20 (either as set via cellW or via mxWidth) then if tableWidth is set to e.g. 50 then cell widths will be 50 * (20 / 80), where 80 is 20*4 = total width of all cells. Works simialar for widths set via mxWidth - determines max sum of widths across all cloumns of mxWidth and adjusts cell widths proportionally to it. If cell widths are 0 (i.e. auto-adjust) tableWidth has no effect.
tableHeight (float) (Optional) Overrides table height if cell heights are non zero. E.g. if there are four rows and cell heights are 20 (either as set via cellH or via mxHeight) then if tableHeigh is set to e.g. 50 then cell heights will be 50 * (20 / 80), where 80 is 20*4 = total height of all cells. Works simialar for heights set via mxHeight - determines max sum of heights across all cloumns of mxHeight and adjusts cell heights proportionally to it. If cell heights are 0 (i.e. auto-adjust) tableHeight has no effect.
defaultTxtColor (color) (Optional) text_color to be used if mxTextColor is not supplied
text_size (string) (Optional) text_size to be used if mxTextSize is not supplied
font_family (string) (Optional) cell text_font_family value to be used if a value in mxFontFamily is no supplied
cellW (float) (Optional) cell width to be used if a value in mxWidth is no supplied
cellH (float) (Optional) cell height to be used if a value in mxHeight is no supplied
halign (string) (Optional) cell text_halign value to be used if a value in mxHalign is no supplied
valign (string) (Optional) cell text_valign value to be used if a value in mxValign is no supplied
Headers parameters:
arColTitles (array) (Optional) Array of column titles. If not na a header row is added.
arRowTitles (array) (Optional) Array of row titles. If not na a header column is added.
cornerTitle (string) (Optional) If both row and column titles are supplied allows to set the value of the corner cell.
colTitlesBgColor (color) (Optional) bgcolor for header row
colTitlesTxtColor (color) (Optional) text_color for header row
rowTitlesBgColor (color) (Optional) bgcolor for header column
rowTitlesTxtColor (color) (Optional) text_color for header column
cornerBgClr (color) (Optional) bgcolor for the corner cell
cornerTxtClr (color) (Optional) text_color for the corner cell
Cell merge parameters:
mxMerge (matrix) (Optional) A matrix determining how cells will be merged. "L" - cell merges to the left, "U" - upwards.
mergeAllColTitles (bool) (Optional) Allows to print a table title instead of column headers, merging all header row cells and leaving just the value of the first cell. For more flexible options use matrix arguments leaving header/row arguments na.
mergeAllRowTitles (bool) (Optional) Allows to print one text value merging all header row cells and leaving just the value of the first cell. For more flexible options use matrix arguments leaving header/row arguments na.
Format:
string_float_separator (string) (Optional) A string used to separate string and float parts of cell values (mxValS and mxValF). Default is " "
format (string) (Optional) format string like in str.format() used to format numerical values
nz (string) (Optional) Determines how na numerical values are displayed.
The only other available function is autotable(string,... ) with a string parameter instead of string and float matrices which draws a one cell table.
█ SAMPLE USE
E.g., CSVParser library demo uses Autotable's for generating complex tables with merged cells.
█ CREDITS
The library was inspired by @kaigouthro's matrixautotable . A true master. Many thanks to him for his creative, beautiful and very helpful libraries.
display_valueOVERVIEW
This script is a tinny library for creating and displaying formatted values in TradingView scripts. It provides a structured way to present key information like titles, percentages, currency values, decimals, and integers with clear formatting. This allows you to coordinate your strings in advance and hold one item to use for calling your string to a label, box, table.. Made for day to day use of most typical use cases, more advanced techniques should be used for complicated scenarios.
Building Blocks
User Defined Types (UDTs)
The script defines a UDT called `DisplayValue` to encapsulate the components of a display value:
* title : The title or label of the value.
* format_string : The string used to format the value (e.g., "{0} - 1,number,percent}").
* value : The actual value to be displayed.
* format : An enum value specifying the desired format (percent, currency, etc.).
Enums
The `DisplayFormat` enum provides predefined constants for various formatting options, making the code more readable and less prone to errors.
Functions
* create() : This function creates a new `DisplayValue` instance. It takes the title, value, and desired format as arguments and generates the appropriate format string.
* to_string() : This function converts a `DisplayValue` instance into a formatted string ready for display on the chart.
How to Use
1. Import the library:
import kaigouthro/display_value/1as dv
2. Create a DisplayValue instance:
myValue = dv.create("My Percentage", 0.5, dv.DisplayFormat.percent)
3. Convert it to a string:
formattedString = dv.to_string(myValue)
4. Display the formatted string:
label.new(bar_index, high, formattedString)
Example
//@version=5
import kaigouthro/display_value/1 as dv
myValue = dv.create("Profit", 0.15, dv.DisplayFormat.percent)
formattedString = dv.to_string(myValue)
label.new(bar_index, high, formattedString)
This will display a label on the chart with the text "Profit - 15%".
### Notes
* The library handles the formatting details, making it easier to display values consistently in your scripts.
* The use of enums and UDTs improves code organization and readability.
--------
Library "display_value"
create(display_name, display_value, display_format)
Gets the appropriate format string based on the display format.
Parameters:
display_name (string) : (string) The name of the display value. Default is na.
display_value (float)
display_format (series DisplayFormat)
Returns: (DisplayValue) A new DisplayValue instance with the formatted value.
to_string(item)
Converts the display value to a string with the specified format.
Parameters:
item (DisplayValue) : (DisplayValue) The display value to convert to a string.
Returns: (string) The string representation of the display value.
DisplayValue
Structure representing a display value.
Fields:
title (series string) : (string) The title of the display value.
format_string (series string) : (string) The format string to use for display.
value (series float) : (float) The value to display.
format (series DisplayFormat) : (DisplayFormat) The format to use.
analytics_tablesLibrary "analytics_tables"
📝 Description
This library provides the implementation of several performance-related statistics and metrics, presented in the form of tables.
The metrics shown in the afforementioned tables where developed during the past years of my in-depth analalysis of various strategies in an atempt to reason about the performance of each strategy.
The visualization and some statistics where inspired by the existing implementations of the "Seasonality" script, and the performance matrix implementations of @QuantNomad and @ZenAndTheArtOfTrading scripts.
While this library is meant to be used by my strategy framework "Template Trailing Strategy (Backtester)" script, I wrapped it in a library hoping this can be usefull for other community strategy scripts that will be released in the future.
🤔 How to Guide
To use the functionality this library provides in your script you have to import it first!
Copy the import statement of the latest release by pressing the copy button below and then paste it into your script. Give a short name to this library so you can refer to it later on. The import statement should look like this:
import jason5480/analytics_tables/1 as ant
There are three types of tables provided by this library in the initial release. The stats table the metrics table and the seasonality table.
Each one shows different kinds of performance statistics.
The table UDT shall be initialized once using the `init()` method.
They can be updated using the `update()` method where the updated data UDT object shall be passed.
The data UDT can also initialized and get updated on demend depending on the use case
A code example for the StatsTable is the following:
var ant.StatsData statsData = ant.StatsData.new()
statsData.update(SideStats.new(), SideStats.new(), 0)
if (barstate.islastconfirmedhistory or (barstate.isrealtime and barstate.isconfirmed))
var statsTable = ant.StatsTable.new().init(ant.getTablePos('TOP', 'RIGHT'))
statsTable.update(statsData)
A code example for the MetricsTable is the following:
var ant.StatsData statsData = ant.StatsData.new()
statsData.update(ant.SideStats.new(), ant.SideStats.new(), 0)
if (barstate.islastconfirmedhistory or (barstate.isrealtime and barstate.isconfirmed))
var metricsTable = ant.MetricsTable.new().init(ant.getTablePos('BOTTOM', 'RIGHT'))
metricsTable.update(statsData, 10)
A code example for the SeasonalityTable is the following:
var ant.SeasonalData seasonalData = ant.SeasonalData.new().init(Seasonality.monthOfYear)
seasonalData.update()
if (barstate.islastconfirmedhistory or (barstate.isrealtime and barstate.isconfirmed))
var seasonalTable = ant.SeasonalTable.new().init(seasonalData, ant.getTablePos('BOTTOM', 'LEFT'))
seasonalTable.update(seasonalData)
🏋️♂️ Please refer to the "EXAMPLE" regions of the script for more advanced and up to date code examples!
Special thanks to @Mrcrbw for the proposal to develop this library and @DCNeu for the constructive feedback 🏆.
getTablePos(ypos, xpos)
Get table position compatible string
Parameters:
ypos (simple string) : The position on y axise
xpos (simple string) : The position on x axise
Returns: The position to be passed to the table
method init(this, pos, height, width, positiveTxtColor, negativeTxtColor, neutralTxtColor, positiveBgColor, negativeBgColor, neutralBgColor)
Initialize the stats table object with the given colors in the given position
Namespace types: StatsTable
Parameters:
this (StatsTable) : The stats table object
pos (simple string) : The table position string
height (simple float) : The height of the table as a percentage of the charts height. By default, 0 auto-adjusts the height based on the text inside the cells
width (simple float) : The width of the table as a percentage of the charts height. By default, 0 auto-adjusts the width based on the text inside the cells
positiveTxtColor (simple color) : The text color when positive
negativeTxtColor (simple color) : The text color when negative
neutralTxtColor (simple color) : The text color when neutral
positiveBgColor (simple color) : The background color with transparency when positive
negativeBgColor (simple color) : The background color with transparency when negative
neutralBgColor (simple color) : The background color with transparency when neutral
method init(this, pos, height, width, neutralBgColor)
Initialize the metrics table object with the given colors in the given position
Namespace types: MetricsTable
Parameters:
this (MetricsTable) : The metrics table object
pos (simple string) : The table position string
height (simple float) : The height of the table as a percentage of the charts height. By default, 0 auto-adjusts the height based on the text inside the cells
width (simple float) : The width of the table as a percentage of the charts width. By default, 0 auto-adjusts the width based on the text inside the cells
neutralBgColor (simple color) : The background color with transparency when neutral
method init(this, seas)
Initialize the seasonal data
Namespace types: SeasonalData
Parameters:
this (SeasonalData) : The seasonal data object
seas (simple Seasonality) : The seasonality of the matrix data
method init(this, data, pos, maxNumOfYears, height, width, extended, neutralTxtColor, neutralBgColor)
Initialize the seasonal table object with the given colors in the given position
Namespace types: SeasonalTable
Parameters:
this (SeasonalTable) : The seasonal table object
data (SeasonalData) : The seasonality data of the table
pos (simple string) : The table position string
maxNumOfYears (simple int) : The maximum number of years that fit into the table
height (simple float) : The height of the table as a percentage of the charts height. By default, 0 auto-adjusts the height based on the text inside the cells
width (simple float) : The width of the table as a percentage of the charts width. By default, 0 auto-adjusts the width based on the text inside the cells
extended (simple bool) : The seasonal table with extended columns for performance
neutralTxtColor (simple color) : The text color when neutral
neutralBgColor (simple color) : The background color with transparency when neutral
method update(this, wins, losses, numOfInconclusiveExits)
Update the strategy info data of the strategy
Namespace types: StatsData
Parameters:
this (StatsData) : The strategy statistics object
wins (SideStats)
losses (SideStats)
numOfInconclusiveExits (int) : The number of inconclusive trades
method update(this, stats, positiveTxtColor, negativeTxtColor, negativeBgColor, neutralBgColor)
Update the stats table object with the given data
Namespace types: StatsTable
Parameters:
this (StatsTable) : The stats table object
stats (StatsData) : The stats data to update the table
positiveTxtColor (simple color) : The text color when positive
negativeTxtColor (simple color) : The text color when negative
negativeBgColor (simple color) : The background color with transparency when negative
neutralBgColor (simple color) : The background color with transparency when neutral
method update(this, stats, buyAndHoldPerc, positiveTxtColor, negativeTxtColor, positiveBgColor, negativeBgColor)
Update the metrics table object with the given data
Namespace types: MetricsTable
Parameters:
this (MetricsTable) : The metrics table object
stats (StatsData) : The stats data to update the table
buyAndHoldPerc (float) : The buy and hold percetage
positiveTxtColor (simple color) : The text color when positive
negativeTxtColor (simple color) : The text color when negative
positiveBgColor (simple color) : The background color with transparency when positive
negativeBgColor (simple color) : The background color with transparency when negative
method update(this)
Update the seasonal data based on the season and eon timeframe
Namespace types: SeasonalData
Parameters:
this (SeasonalData) : The seasonal data object
method update(this, data, positiveTxtColor, negativeTxtColor, neutralTxtColor, positiveBgColor, negativeBgColor, neutralBgColor, timeBgColor)
Update the seasonal table object with the given data
Namespace types: SeasonalTable
Parameters:
this (SeasonalTable) : The seasonal table object
data (SeasonalData) : The seasonal cell data to update the table
positiveTxtColor (simple color) : The text color when positive
negativeTxtColor (simple color) : The text color when negative
neutralTxtColor (simple color) : The text color when neutral
positiveBgColor (simple color) : The background color with transparency when positive
negativeBgColor (simple color) : The background color with transparency when negative
neutralBgColor (simple color) : The background color with transparency when neutral
timeBgColor (simple color) : The background color of the time gradient
SideStats
Object that represents the strategy statistics data of one side win or lose
Fields:
numOf (series int)
sumFreeProfit (series float)
freeProfitStDev (series float)
sumProfit (series float)
profitStDev (series float)
sumGain (series float)
gainStDev (series float)
avgQuantityPerc (series float)
avgCapitalRiskPerc (series float)
avgTPExecutedCount (series float)
avgRiskRewardRatio (series float)
maxStreak (series int)
StatsTable
Object that represents the stats table
Fields:
table (series table) : The actual table
rows (series int) : The number of rows of the table
columns (series int) : The number of columns of the table
StatsData
Object that represents the statistics data of the strategy
Fields:
wins (SideStats)
losses (SideStats)
numOfInconclusiveExits (series int)
avgFreeProfitStr (series string)
freeProfitStDevStr (series string)
lossFreeProfitStDevStr (series string)
avgProfitStr (series string)
profitStDevStr (series string)
lossProfitStDevStr (series string)
avgQuantityStr (series string)
MetricsTable
Object that represents the metrics table
Fields:
table (series table) : The actual table
rows (series int) : The number of rows of the table
columns (series int) : The number of columns of the table
SeasonalData
Object that represents the seasonal table dynamic data
Fields:
seasonality (series Seasonality)
eonToMatrixRow (map)
numOfEons (series int)
mostRecentMatrixRow (series int)
balances (matrix)
returnPercs (matrix)
maxDDs (matrix)
eonReturnPercs (array)
eonCAGRs (array)
eonMaxDDs (array)
SeasonalTable
Object that represents the seasonal table
Fields:
table (series table) : The actual table
headRows (series int) : The number of head rows of the table
headColumns (series int) : The number of head columns of the table
eonRows (series int) : The number of eon rows of the table
seasonColumns (series int) : The number of season columns of the table
statsRows (series int)
statsColumns (series int) : The number of stats columns of the table
rows (series int) : The number of rows of the table
columns (series int) : The number of columns of the table
extended (series bool) : Whether the table has additional performance statistics
dataTableUtilitiesLibrary "dataTableUtilities"
generate_dataTable(dataTable_map, title, tableYpos, tableXpos)
: Generates and shows a data table.
Parameters:
dataTable_map (map)
title (string) : (string): Title of the table
tableYpos (string) : (string): Vertical position of the table
tableXpos (string) : (string): Horizontal position of the table
Returns: : None
DrawingLibrary "Drawing"
User Defined types and methods for basic drawing structure. Consolidated from the earlier libraries - DrawingTypes and DrawingMethods
method get_price(this, bar)
get line price based on bar
Namespace types: Line
Parameters:
this (Line) : (series Line) Line object.
bar (int) : (series/int) bar at which line price need to be calculated
Returns: line price at given bar.
method init(this)
Namespace types: PolyLine
Parameters:
this (PolyLine)
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Point object to string representation
Namespace types: chart.point
Parameters:
this (chart.point) : DrawingTypes/Point object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Point
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/LineProperties object to string representation
Namespace types: LineProperties
Parameters:
this (LineProperties) : DrawingTypes/LineProperties object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/LineProperties
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Line object to string representation
Namespace types: Line
Parameters:
this (Line) : DrawingTypes/Line object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Line
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/LabelProperties object to string representation
Namespace types: LabelProperties
Parameters:
this (LabelProperties) : DrawingTypes/LabelProperties object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/LabelProperties
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Label object to string representation
Namespace types: Label
Parameters:
this (Label) : DrawingTypes/Label object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Label
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Linefill object to string representation
Namespace types: Linefill
Parameters:
this (Linefill) : DrawingTypes/Linefill object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Linefill
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/BoxProperties object to string representation
Namespace types: BoxProperties
Parameters:
this (BoxProperties) : DrawingTypes/BoxProperties object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/BoxProperties
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/BoxText object to string representation
Namespace types: BoxText
Parameters:
this (BoxText) : DrawingTypes/BoxText object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/BoxText
method tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Box object to string representation
Namespace types: Box
Parameters:
this (Box) : DrawingTypes/Box object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys (array) : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Box
method delete(this)
Deletes line from DrawingTypes/Line object
Namespace types: Line
Parameters:
this (Line) : DrawingTypes/Line object
Returns: Line object deleted
method delete(this)
Deletes label from DrawingTypes/Label object
Namespace types: Label
Parameters:
this (Label) : DrawingTypes/Label object
Returns: Label object deleted
method delete(this)
Deletes Linefill from DrawingTypes/Linefill object
Namespace types: Linefill
Parameters:
this (Linefill) : DrawingTypes/Linefill object
Returns: Linefill object deleted
method delete(this)
Deletes box from DrawingTypes/Box object
Namespace types: Box
Parameters:
this (Box) : DrawingTypes/Box object
Returns: DrawingTypes/Box object deleted
method delete(this)
Deletes lines from array of DrawingTypes/Line objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Line objects
Returns: Array of DrawingTypes/Line objects
method delete(this)
Deletes labels from array of DrawingTypes/Label objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Label objects
Returns: Array of DrawingTypes/Label objects
method delete(this)
Deletes linefill from array of DrawingTypes/Linefill objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Linefill objects
Returns: Array of DrawingTypes/Linefill objects
method delete(this)
Deletes boxes from array of DrawingTypes/Box objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Box objects
Returns: Array of DrawingTypes/Box objects
method clear(this)
clear items from array of DrawingTypes/Line while deleting underlying objects
Namespace types: array
Parameters:
this (array) : array
Returns: void
method clear(this)
clear items from array of DrawingTypes/Label while deleting underlying objects
Namespace types: array
Parameters:
this (array) : array
Returns: void
method clear(this)
clear items from array of DrawingTypes/Linefill while deleting underlying objects
Namespace types: array
Parameters:
this (array) : array
Returns: void
method clear(this)
clear items from array of DrawingTypes/Box while deleting underlying objects
Namespace types: array
Parameters:
this (array) : array
Returns: void
method draw(this)
Creates line from DrawingTypes/Line object
Namespace types: Line
Parameters:
this (Line) : DrawingTypes/Line object
Returns: line created from DrawingTypes/Line object
method draw(this)
Creates lines from array of DrawingTypes/Line objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Line objects
Returns: Array of DrawingTypes/Line objects
method draw(this)
Creates label from DrawingTypes/Label object
Namespace types: Label
Parameters:
this (Label) : DrawingTypes/Label object
Returns: label created from DrawingTypes/Label object
method draw(this)
Creates labels from array of DrawingTypes/Label objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Label objects
Returns: Array of DrawingTypes/Label objects
method draw(this)
Creates linefill object from DrawingTypes/Linefill
Namespace types: Linefill
Parameters:
this (Linefill) : DrawingTypes/Linefill objects
Returns: linefill object created
method draw(this)
Creates linefill objects from array of DrawingTypes/Linefill objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Linefill objects
Returns: Array of DrawingTypes/Linefill used for creating linefills
method draw(this)
Creates box from DrawingTypes/Box object
Namespace types: Box
Parameters:
this (Box) : DrawingTypes/Box object
Returns: box created from DrawingTypes/Box object
method draw(this)
Creates labels from array of DrawingTypes/Label objects
Namespace types: array
Parameters:
this (array) : Array of DrawingTypes/Label objects
Returns: Array of DrawingTypes/Label objects
method createLabel(this, lblText, tooltip, properties)
Creates DrawingTypes/Label object from DrawingTypes/Point
Namespace types: chart.point
Parameters:
this (chart.point) : DrawingTypes/Point object
lblText (string) : Label text
tooltip (string) : Tooltip text. Default is na
properties (LabelProperties) : DrawingTypes/LabelProperties object. Default is na - meaning default values are used.
Returns: DrawingTypes/Label object
method createLine(this, other, properties)
Creates DrawingTypes/Line object from one DrawingTypes/Point to other
Namespace types: chart.point
Parameters:
this (chart.point) : First DrawingTypes/Point object
other (chart.point) : Second DrawingTypes/Point object
properties (LineProperties) : DrawingTypes/LineProperties object. Default set to na - meaning default values are used.
Returns: DrawingTypes/Line object
method createLinefill(this, other, fillColor, transparency)
Creates DrawingTypes/Linefill object from DrawingTypes/Line object to other DrawingTypes/Line object
Namespace types: Line
Parameters:
this (Line) : First DrawingTypes/Line object
other (Line) : Other DrawingTypes/Line object
fillColor (color) : fill color of linefill. Default is color.blue
transparency (int) : fill transparency for linefill. Default is 80
Returns: Array of DrawingTypes/Linefill object
method createBox(this, other, properties, textProperties)
Creates DrawingTypes/Box object from one DrawingTypes/Point to other
Namespace types: chart.point
Parameters:
this (chart.point) : First DrawingTypes/Point object
other (chart.point) : Second DrawingTypes/Point object
properties (BoxProperties) : DrawingTypes/BoxProperties object. Default set to na - meaning default values are used.
textProperties (BoxText) : DrawingTypes/BoxText object. Default is na - meaning no text will be drawn
Returns: DrawingTypes/Box object
method createBox(this, properties, textProperties)
Creates DrawingTypes/Box object from DrawingTypes/Line as diagonal line
Namespace types: Line
Parameters:
this (Line) : Diagonal DrawingTypes/PoLineint object
properties (BoxProperties) : DrawingTypes/BoxProperties object. Default set to na - meaning default values are used.
textProperties (BoxText) : DrawingTypes/BoxText object. Default is na - meaning no text will be drawn
Returns: DrawingTypes/Box object
LineProperties
Properties of line object
Fields:
xloc (series string) : X Reference - can be either xloc.bar_index or xloc.bar_time. Default is xloc.bar_index
extend (series string) : Property which sets line to extend towards either right or left or both. Valid values are extend.right, extend.left, extend.both, extend.none. Default is extend.none
color (series color) : Line color
style (series string) : Line style, valid values are line.style_solid, line.style_dashed, line.style_dotted, line.style_arrow_left, line.style_arrow_right, line.style_arrow_both. Default is line.style_solid
width (series int) : Line width. Default is 1
Line
Line object created from points
Fields:
start (chart.point) : Starting point of the line
end (chart.point) : Ending point of the line
properties (LineProperties) : LineProperties object which defines the style of line
object (series line) : Derived line object
LabelProperties
Properties of label object
Fields:
xloc (series string) : X Reference - can be either xloc.bar_index or xloc.bar_time. Default is xloc.bar_index
yloc (series string) : Y reference - can be yloc.price, yloc.abovebar, yloc.belowbar. Default is yloc.price
color (series color) : Label fill color
style (series string) : Label style as defined in Tradingview Documentation. Default is label.style_none
textcolor (series color) : text color. Default is color.black
size (series string) : Label text size. Default is size.normal. Other values are size.auto, size.tiny, size.small, size.normal, size.large, size.huge
textalign (series string) : Label text alignment. Default if text.align_center. Other allowed values - text.align_right, text.align_left, text.align_top, text.align_bottom
text_font_family (series string) : The font family of the text. Default value is font.family_default. Other available option is font.family_monospace
Label
Label object
Fields:
point (chart.point) : Point where label is drawn
lblText (series string) : label text
tooltip (series string) : Tooltip text. Default is na
properties (LabelProperties) : LabelProperties object
object (series label) : Pine label object
Linefill
Linefill object
Fields:
line1 (Line) : First line to create linefill
line2 (Line) : Second line to create linefill
fillColor (series color) : Fill color
transparency (series int) : Fill transparency range from 0 to 100
object (series linefill) : linefill object created from wrapper
BoxProperties
BoxProperties object
Fields:
border_color (series color) : Box border color. Default is color.blue
bgcolor (series color) : box background color
border_width (series int) : Box border width. Default is 1
border_style (series string) : Box border style. Default is line.style_solid
extend (series string) : Extend property of box. default is extend.none
xloc (series string) : defines if drawing needs to be done based on bar index or time. default is xloc.bar_index
BoxText
Box Text properties.
Fields:
boxText (series string) : Text to be printed on the box
text_size (series string) : Text size. Default is size.auto
text_color (series color) : Box text color. Default is color.yellow.
text_halign (series string) : horizontal align style - default is text.align_center
text_valign (series string) : vertical align style - default is text.align_center
text_wrap (series string) : text wrap style - default is text.wrap_auto
text_font_family (series string) : Text font. Default is
Box
Box object
Fields:
p1 (chart.point) : Diagonal point one
p2 (chart.point) : Diagonal point two
properties (BoxProperties) : Box properties
textProperties (BoxText) : Box text properties
object (series box) : Box object created
PolyLineProperties
Fields:
curved (series bool)
closed (series bool)
xloc (series string)
lineColor (series color)
fillColor (series color)
lineStyle (series string)
lineWidth (series int)
PolyLine
Fields:
points (array)
properties (PolyLineProperties)
object (series polyline)
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.
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.
PubLibUtilityLibrary "PubLibUtility"
utilities for indicator and strategy development
size(size)
size to string conversion
Parameters:
size (string)
Returns: const string
tab_pos(tab_pos)
table position to string conversion
Parameters:
tab_pos (string)
Returns: const string
time_string(time_in)
time to string conversion
Parameters:
time_in (int)
Returns: literal string
lib_datesLibrary "lib_dates"
TODO: add library description here
inDateRange(from, thru)
inDateRange: Checks if the time `t` is in range between `from` to `thru`
Parameters:
from (int)
thru (int)
Returns: bool: true if time is in range false otherwise
Dark & Light Theme [TradingFinder] Switching Colors Library🔵 Introduction
One of the challenges of script users is matching the colors used in indicators or strategies. By default, colors are chosen to display based on either the dark theme or the light theme.
In scripts with a large number of colors used, changing all colors to better display in dark mode or light mode can be a difficult and tedious process.
This library provides developers with the ability to adjust the colors used in their scripts based on the theme of the display.
🔵 Logic
To categorize the color spectrum, the range from 0 to 255 of all three main colors red, green and blue was divided into smaller ranges.
Blue color, which is more effective in darkening or lightening colors, is divided into 8 categories, red color into 5 categories, and green color into 3 categories, because it has little effect on darkening or brightening colors.
The combination of these categories creates 120 different modes for the color range, which leads to a more accurate identification of the color and its brightness, and helps to decide how to change it.
Except for these 120 modes, there are 2 other modes that are related to colors almost white or black, which makes a total of 122 modes.
🔵 How to Use
First, you can add the library to your code as shown in the example below.
import TFlab/Dark_Light_Theme_TradingFinder_Switching_Colors_Library/1 as SC
🟣 Parameters
SwitchingColorMode(Color, Mode) =>
Parameters:
Color (color)
Mode (string)
Color : In this parameter, enter the color you want to adjust based on light mode and dark mode.
Mode : Three modes "Off", "Light" and "Dark" are included in this parameter. "Light" mode is for color adjustment for use in "Light Mode".
"Dark" mode is for color adjustment for use in "Dark Mode" and "Off" mode turns off the color adjustment function and the input color to the function is the same as the output color.
🔵 Function Outputs
OriginalColor = input.color(color.red)
= SC.SwitchingColorMode(OriginalColor, Mode)
ChartUtilsLibrary "ChartUtils"
Library for chart utilities, including managing tables
initTable(rows, cols, bgcolor)
Initializes a table with specific dimensions and color
Parameters:
rows (int) : (int) Number of rows in the table
cols (int) : (int) Number of columns in the table
bgcolor (color) : (color) Background color of the table
Returns: (table) The initialized table
updateTable(tbl, is_price_below_avg, current_investment_USD, strategy_position_size, strategy_position_avg_price, strategy_openprofit, strategy_opentrades, isBullishRate, isBearishRate, mlRSIOverSold, mlRSIOverBought)
Updates the trading table
Parameters:
tbl (table) : (table) The table to update
is_price_below_avg (bool) : (bool) If the current price is below the average price
current_investment_USD (float) : (float) The current investment in USD
strategy_position_size (float) : (float) The size of the current position
strategy_position_avg_price (float) : (float) The average price of the current position
strategy_openprofit (float) : (float) The current open profit
strategy_opentrades (int) : (int) The number of open trades
isBullishRate (bool) : (bool) If the current rate is bullish
isBearishRate (bool) : (bool) If the current rate is bearish
mlRSIOverSold (bool) : (bool) If the ML RSI is oversold
mlRSIOverBought (bool) : (bool) If the ML RSI is overbought
updateTableNoPosition(tbl)
Updates the table when there is no position
Parameters:
tbl (table) : (table) The table to update
SessionBoxLibrary "SessionBox"
This library provides functions to manage and visualize session boxes and labels on chart. A session box is a visual representation of a trading session with properties like time, name, color and the ability to track the high and low price within that session.
SessionBox
SessionBox: stores session data and provides methods to manage that data and visualize it on the chart.
Fields:
session_time (series bool)
session_name (series string)
session_color (series color)
[ALGOA+] AutofiboLibrary "Autofibo"
fibonacci(up, down, calculate, log, color1, color2, plot)
Creates an array with fibbonaci levels and plots lines.
Parameters:
up (float)
down (float)
calculate (bool)
log (bool)
color1 (color)
color2 (color)
plot (bool)
Returns: --> var float tupple.
fibonacciExtension(up, down, direction, log, calculate, color1, plot)
Fibonacci extension.
@description up (float) Up level.
@description down (float) Down level.
@description direction (string) Options "up" or "down".
Parameters:
up (float)
down (float)
direction (string)
log (bool)
calculate (bool)
color1 (color)
plot (bool)
Returns: -> var float, var float
trendFibo(uptrend, downtrend, log_option, color1, color2, plot)
Calculates automatic fibo values based on trends, returning a tupple with most important values.
Parameters:
uptrend (bool)
downtrend (bool)
log_option (bool)
color1 (color)
color2 (color)
plot (bool)
Returns:
signalLib_yashgode9Signal Generation Library = "signalLib_yashgode9"
This library, named "signalLib_yashgode9", is designed to generate buy and sell signals based on the price action of a financial instrument. It utilizes various technical indicators and parameters to determine the market direction and provide actionable signals for traders.
Key Features:-
1.Trend Direction Identification: The library calculates the trend direction by comparing the number of bars since the highest and lowest prices within a specified depth. This allows the library to determine the overall market direction, whether it's bullish or bearish.
2.Dynamic Price Tracking: The library maintains two chart points, zee1 and zee2, which dynamically track the price levels based on the identified market direction. These points serve as reference levels for generating buy and sell signals.
3.Customizable Parameters: The library allows users to adjust several parameters, including the depth of the price analysis, the deviation threshold, and the number of bars to consider for the trend direction. This flexibility enables users to fine-tune the library's behavior to suit their trading strategies.
4.Visual Representation: The library provides a visual representation of the buy and sell signals by drawing a line between the zee1 and zee2 chart points. The line's color changes based on the identified market direction, with red indicating a bearish signal and green indicating a bullish signal.
Usage and Integration:
To use this library, you can call the "signalLib_yashgode9" function and pass in the necessary parameters, such as the lower and higher prices, the depth of the analysis, the deviation threshold, and the number of bars to consider for the trend direction. The function will return the direction of the market (1 for bullish, -1 for bearish), as well as the zee1 and zee2 chart points.You can then use these values to generate buy and sell signals in your trading strategy. For example, you could use the direction value to determine when to enter or exit a trade, and the zee1 and zee2 chart points to set stop-loss or take-profit levels.
Potential Use Cases:
This library can be particularly useful for traders who:
1.Trend-following Strategies: The library's ability to identify the market direction can be beneficial for traders who employ trend-following strategies, as it can help them identify the dominant trend and time their entries and exits accordingly.
2.Swing Trading: The dynamic price tracking provided by the zee1 and zee2 chart points can be useful for swing traders, who aim to capture medium-term price movements.
3.Automated Trading Systems: The library's functionality can be integrated into automated trading systems, allowing for the development of more sophisticated and rule-based trading strategies.
4.Educational Purposes: The library can also be used for educational purposes, as it provides a clear and concise way to demonstrate the application of technical analysis concepts in a trading context.
Important Notice:- This library effectively work on timeframe of 5-minute and 15-minute.
ColourUtilitiesLibrary "ColourUtilities"
Utility functions for colour manipulation
adjust_colour(rgb, desaturation_amount, transparency_amount)
to reduce saturation or increase transparency of an RGB colour
Parameters:
rgb (color)
desaturation_amount (float) : 0 means no desaturation (colours remains as-is), and 1 means full desaturation (colour turns grey). Can also be used inversely with negative numbers
transparency_amount (float) : How much more transparent the default transparency should become. E.g. with a value of 0.5, a transparency of 0 becomes 50 and 40 becomes 70. A value of 1 makes it fully transparent, en -1 fully opaque.
Returns: color with adjusted saturation and transparency
method apply_default_palette(self, palette_name)
Some nice looking colour palettes, consisting of 6 gradient colours, are already defined here and can be quickly applied to the Palette class
Namespace types: Palette
Parameters:
self (Palette)
palette_name (string) : Currently there are 4 6-coloured palettes available: "GYTS flux signal", "GYTS purple", "GYTS flux filter" and "GYTS maroon"
Returns: None, as it populates the Palette class with pre-defined colours
method get_colour(self, colour_no, transparency)
Retrieves colour from the palette and possibly changes transparency if set
Namespace types: Palette
Parameters:
self (Palette)
colour_no (int) : from the palette
transparency (int) : to possibly change the default transparency of the palette
Returns: colour
method get_dynamic_colour(self, x, mid_point, colour_lb, colour_ub, trend_lookback, use_rate)
Retrieves a colour based on strength and direction of the passed series
Namespace types: Palette
Parameters:
self (Palette)
x (float) : the input data series
mid_point (float) : value as a cutoff point where the bullish/bearish colour scenario
colour_lb (float) : value (lower bound) where to apply the bearish colour at full strength
colour_ub (float) : value (upper bound) where to apply the bullish colour at full strength
trend_lookback (int) : how much bars back to check if there was a consistent move into a certain direction, otherwise a the neutral colour from the centre of the palette will be used.
use_rate (bool) : whether to use the rate (proportional difference with previous `x` value) or the input series `x` directly
Returns: colour
Palette
Fields:
transparency (series__integer)
palette (array__color)
Sessions KillZones Library [TradingFinder]🔵 Introduction
"The Forex Trading Sessions" highlight the active periods across different markets where significant trading volume and influence on the forex market are evident. The primary trading sessions globally include the "Asian Session," "London Session," and "New York Session."
A "Kill Zone" refers to a segment within a session characterized by high trading volume and notably sharper price movements. Consequently, there's a higher probability of encountering price action setups within these zones. Traders capitalize on this phenomenon in pursuit of more successful trading outcomes.
If you aim to integrate sessions or kill zones into your indicators or strategies, utilizing this library can amplify the precision and efficiency of your Python script development.
🔵 How to Use
First, you can add the library to your code as shown in the example below:
import TFlab/SessionAndKillZoneLibrary_TradingFinder/1
🟣 Parameters
SessionDetector(Session_Name, Session_Time, KillZone_Time, Session_Show, KillZone_Show, AreaUpdate, MoreInfo, Session_Color, Info_Color) =>
Parameters:
•Session_Name (string)
•Session_Time (string)
•KillZone_Time (string)
•Session_Show (bool)
•KillZone_Show (bool)
•AreaUpdate (string)
•MoreInfo (bool)
•Session_Color (color)
•Info_Color (color)
Session_Name : You must enter the session name in this parameter.
Session_Time : Enter here the start and end time of the session, which should be based on the UTC time zone.
KillZone_Time : Enter the start and end times of the kill zone, which should be based on the UTC time zone, here.
Session_Show : You can control whether or not to show the session using this entry. You must set true to display and false to not display.
KillZone_Show : Using this input you can control whether the kill zone is displayed or not. You must set true to display and false to not display.
AreaUpdate : If you want the session to be determined based on the time and high and low of the session itself, you must enter "Session" and if you want the area to be determined based on the time and high and low of the kill zone, you must enter "Kill Zone".
MoreInfo : If you want more information, you should set this entry to true, otherwise set to false. This information includes the number of candles in the area, the length of time in the area and the volume of transactions in the area.
Session_Color : Enter your desired color to display the session at this section. It is recommended to use bright and sharp colors.
Info_Color : Enter your desired color to display more information in this section.
🔵 Function Outputs
The outputs of this function are direct and indirect.
🟣 Indirect outputs
These outputs include session display, kill zone display, and time and volume information of session or kill zone.
🟣 Direct outputs
There are 8 direct outputs, which are:
Session Time : If the Session is active, it outputs 1, and if the Session is inactive, it outputs 0.
Kill Zone Time : If the Kill Zone is active, it outputs 1, and if the Kill Zone is inactive, it outputs 0.
Open : Session opening price.
High : The highest price of the session.
Low : The lowest price of the session.
Close : The last price of the session.
Low Touch Alert : If "Area Update" is in "Kill Zone" mode, if the price reaches the lowest price of the kill zone in the same session after the end of the kill zone, this output will be true. You can use this output to create an alert.
High Touch Alert : If "Area Update" is in "Kill Zone" mode, if the price reaches the highest price of the kill zone in the same session after the end of the kill zone, this output will be true. You can use this output to create an alert.
Important : To use "Open", "High", "Low" and "Close", "Area Update" must be in "Session" mode.
Order Block Drawing [TradingFinder]🔵 Introduction
Perhaps one of the most challenging tasks for Pine script developers (especially beginners) is properly drawing order blocks. While utilizing the latest technical analysis methods for "Price Action," beginners heavily rely on accurately plotting "Supply" and "Demand" zones, following concepts like "Smart Money Concept" and "ICT".
However, drawing "Order Blocks" may pose a challenge for developers. Therefore, to minimize bugs, increase accuracy, and speed up the process of coding order blocks, we have released the "Order Block Drawing" library.
Below, you can read more details about how to use this library.
Important :
This library has direct and indirect outputs. The indirect output includes the ranges of order blocks plotted on the chart. However, the direct output is a "Boolean" value that becomes "true" only when the price touches an order block, colloquially termed as "Mitigate." You can use this output for setting up alerts.
🔵 How to Use
First, you can add the library to your code as shown in the example below.
import TFlab/OrderBlockDrawing_TradingFinder/1
🟣Parameters
OBDrawing(OBType, TriggerCondition, DistalPrice, ProximalPrice, Index, OBValidDis, Show, ColorZone) =>
Parameters:
• OBType (string)
• TriggerCondition (bool)
• DistalPrice (float)
• ProximalPrice (float)
• Index (int)
• OBValidDis (int)
• Show (bool)
• ColorZone (color)
OBType : All order blocks are summarized into two types: "Supply" and "Demand." You should input your order block type in this parameter. Enter "Demand" for drawing demand zones and "Supply" for drawing supply zones.
TriggerCondition : Input the condition under which you want the order block to be drawn in this parameter.
DistalPrice : Generally, if each zone is formed by two lines, the farthest line from the price is termed "Distal." This input receives the price of the "Distal" line.
ProximalPrice : Generally, if each zone is formed by two lines, the nearest line to the price is termed "Proximal" line.
Index : 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 order block to be drawn and input it here.
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.
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.
🔵 Function Outputs
This function has only one output. This output is of type "Boolean" and becomes "true" only when the price touches an order block. Each order block can be touched only once and then loses its validity. You can use this output for alerts.
= Drawing.OBDrawing('Demand', Condition, Distal, Proximal, Index, 4998, true, Color)
garbage_collection_and_utilitiesGarbage Collection and Utilities is a library that offers a set of functions designed for efficient management of various types of arrays. This library provides garbage collection utilities to remove and delete excess elements, and also includes utilities for checking the size of arrays. It's particularly useful for developers who want to manage labels, lines, polylines, boxes, linefills, chart points, floats, integers, booleans, and strings efficiently within their scripts.
Both dump and trim act on the array backwards . This means that for trim , the elements that will be left start from 0. If you want the most recent element to be left after trim, you must use unshift().
Garbage Collection:
Functions to remove and delete excess elements from various types of arrays.
Useful for freeing up memory and keeping the arrays within desired size limits.
Size Checking:
Functions to check if arrays are larger than a specified size.
Helps in ensuring that arrays have enough elements before performing operations.
Supported Types:
Compatible with a wide range of array types, including labels, lines, polylines, boxes, linefills, chart points, floats, integers, booleans, and strings.
Usage:
The dump methods are ideal for clearing out unwanted elements from arrays, while the trim methods allow for more refined control over the size of arrays.
The ready methods enable you to verify if arrays have the required number of elements before proceeding with further operations.
Library "garbage_collection_and_utilities"
Provides garbage collection utilities for managing and trimming various types of arrays, and utilities to check if an array is of a specific size. Included types are: labels, lines, polylines, boxes, linefills, chart points, floats, integers, booleans, and strings.
method ready(self, size)
Checks if an array of labels is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of lines is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of polylines is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of boxes is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of linefills is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of chart points is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of floats is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of integers is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of booleans is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method ready(self, size)
Checks if an array of strings is larger than a specified size
Namespace types: array
Parameters:
self (array)
size (int) : The minimum size of the array
Returns: A boolean indicating whether the array is ready
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of labels
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of lines
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of polylines
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of boxes
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of linefills
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of chart points
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of floats
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of integers
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of booleans
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method dump(self, max_size, trigger)
Removes and deletes excess elements from an array of strings
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
trigger (bool) : A condition to trigger the dumping process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of labels
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of lines
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of polylines
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of boxes
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of linefills
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of chart points
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of floats
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of integers
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of booleans
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
method trim(self, max_size, min_size, trigger)
Removes excess elements and trims an array of strings
Namespace types: array
Parameters:
self (array)
max_size (int) : The maximum size of the array
min_size (int) : The minimum size of the array
trigger (bool) : A condition to trigger the trimming process
Returns: void
Order Block Refiner [TradingFinder]🔵 Introduction
The "Refinement" feature allows you to adjust the width of the order block according to your strategy. There are two modes, "Aggressive" and "Defensive," in the "Order Block Refine". The difference between "Aggressive" and "Defensive" lies in the width of the order block.
For risk-averse traders, the "Defensive" mode is suitable as it provides a lower loss limit and a greater reward-to-risk ratio. For risk-taking traders, the "Aggressive" mode is more appropriate. These traders prefer to enter trades at higher prices, and this mode, which has a wider order block width, is more suitable for this group of individuals.
Important :
One of the advantages of using this library is increased code accuracy. Not only does it have the capability to create order blocks, but you can also simply define the condition for order block creation (true/false) and "bar_index," and you'll find the primary range without applying any filters.
🟣 Order Block Refinement Algorithm
The order block ranges are filtered in two stages. In the first stage, the "Open," "High," "Low," and "Close" of the current order block candle, its two or three previous candles, and one subsequent candle (if available) are examined. In this stage, minimum and maximum distances are calculated, and logical range filters are applied.
In the second stage, two modes, "Aggressive" and "Defensive," are calculated.
For the "Defensive" mode, the width of these ranges is compared with the "ATR" (Average True Range) of period 55, and if they are smaller than "ATR" or 1 to more than 4 times "ATR," the width of the range is reduced from 0 to 80 percent.
For the "Aggressive" mode, you get the same output as the first filter, which usually has a wider width than the "Defensive" mode.
• Order Block Refiner : Off
• Order Block Refiner : On / "Aggressive Mode"
• Order Block Refiner : On / "Defensive Mode"
🔵 How to Use
OBRefiner(string OBType, string OBRefine, string RefineMethod, bool TriggerCondition, int Index) =>
Parameters:
• OBType (string)
• OBRefine (string)
• RefineMethod (string)
• TriggerCondition (bool)
• Index (int)
To add "Order Block Refiner Library", you must first add the following code to your script.
import TFlab/OrderBlockRefiner_TradingFinder/1
OBType : This parameter receives 2 inputs. If the order block you want to "Refine" is of type demand, you should enter "Demand," and if it's of type supply, you should enter "Supply."
OBRefine : Set to "On" if you want the "Refine" operation to be performed. Otherwise, set to "Off."
RefineMethod : This input receives 2 modes, "Aggressive" and "Defensive." You can switch between these modes according to your needs.
TriggerCondition : Enter the condition with which the order block is formed in this parameter.
Index : Enter the "bar_index" of the candle where the order block is formed in this parameter.
🟣 Function Outputs
This function has 6 outputs: "bar_index" at the beginning of the "Distal" line, "bar_index+1" at the end of the "Distal" line, "Price" at the "Distal" line, "bar_index" at the beginning of the "Proximal" line, "bar_index+1" at the end of the "Proximal" line, and "Price" at the "Proximal" line, which can be used to draw order blocks.
Sample :
= Refiner.OBRefiner('Demand', 'Off', 'Aggressive',BuMChMain_Trigger, BuMChMain_Index)
if BuMChMain_Trigger
BuMChHlineMain := line.new(BuMChMain_Xp1 , BuMChMain_Yp12 , bar_index , BuMChMain_Yp12, color = color.black , style = line.style_dotted)
BuMChLlineMain := line.new(BuMChMain_Xd1 , BuMChMain_Yd12 , bar_index , BuMChMain_Yd12, color = color.black , style = line.style_dotted)
BuMChFilineMain := linefill.new(BuMChHlineMain ,BuMChLlineMain , color = color.rgb(76, 175, 80 , 75 ) )
Alert Sender Library [TradingFinder]Library "AlertSenderLibrary_TradingFinder"
🔵 Introduction
The "Alert Sender Library" is a management and production program for "Alert Messages" that enables the creation of unique messages for any type of signal generated by indicators or strategies.
These messages include the direction of the signal, symbol, time frame, the date and time the condition was triggered, prices related to the signal, and a personal message from you. To make better and more optimal use of this "library", you should carefully study " Key Features" and "How to Use".
🔵 Key Features
Automatic Detection of Appropriate Type :
Using two parameters, "AlertType" and "DetectionType", which you must enter at the beginning into the "AlertSender" function, the type of the alert message is determined.
For example, if you select one of the "DetectionType"s such as "Order Block Signal", "Signal", and "Setup", your alert type will be chosen based on "Long" and "Short". Whether it's "Long" or "Short" depends on the "AlertType" you have set to either "Bullish" or "Bearish".
Automatic Symbol Detection :
Whenever you add an alert for a specific symbol, if you want the name of that symbol to be in your message text, you must manually write the name of the symbol in your message. One of the capabilities of the "Alert Sender" is the automatic detection of the symbol and adding it to the message text.
Automatic Time Frame Detection :
When adding your alert, the "Alert Sender" detects the time frame of the symbol you intend to add the alert for and adds it to the text. This feature is very practical and can prevent traders from making mistakes.
For example, a trader might add alerts for a specific symbol using a specific indicator in different time frames, taking the main signal in the 1-hour time frame and only a confirmation signal in the 15-minute time frame. This feature helps to identify in which time frame the signal is set.
Detection of Date and Time When the Signal is Triggered :
You can have the date and time at the moment the message is sent. This feature has various uses. For example, if you use the Webhook URL feature to send messages to a Telegram channel, there might be issues with alert delivery on your server, causing delays, and you might receive the message when it has lost its validity.
With this feature, you can match the sending time of the message from TradingView with the receipt time in your messenger and detect if there is a delay in message delivery.
Important :
You can also set the Time Zone you wish to receive the date and time based on.
Display of "Key Prices" :
Key prices can vary based on the type of signals. For example, when the "DetectionType" is in "Order Block Signal" mode, the key prices are the "Distal" and "Proximal" prices. Or if the "DetectionType" is in "Setup" mode, the key prices are "Entry", "Stop Loss", and "Take Profit".
Receipt of Personal "Messages" :
You can enter your personal message using "input.string" or "input.text_area" in addition to the messages that are automatically created.
Beautiful and Functional Display of Messages :
The titles of messages sent by "AlertSender" are displayed using related emojis to prevent mistakes due to visual errors, enhancing beauty.
🔵 How to Use
🟣 Familiarity with Function and Parameters
AlertSender(Condition, Alert, AlertName, AlertType, DetectionType, SetupData, Frequency, UTC, MoreInfo, Message, o, h, l, c, Entry, TP, SL, Distal, Proximal)
Parameters:
- Condition (bool)
- Alert (string)
- AlertName (string)
- AlertType (string)
- DetectionType (string)
- SetupData (string)
- Frequency (string)
- UTC (string)
- MoreInfo (string)
- Message (string)
- o (float)
- h (float)
- l (float)
- c (float)
- Entry (float)
- TP (float)
- SL (float)
- Distal (float)
- Proximal (float)
To add "Alert Sender Library", you must first add the following code to your script.
import TFlab/AlertSenderLibrary_TradingFinder/1
🟣 Parameters
"Condition" : This parameter is a Boolean. You need to set it based on the condition that, when met (or fired), you want to receive an alert. The output should be either "true" or "false".
"Alert" : This parameter accepts one of two inputs, "On" or "Off". If set to "On", the alarm is active; if "Off", the alarm is deactivated. This input is useful when you have numerous alerts in an indicator or strategy and need to activate only a few of them. "Alert" is a string parameter.
Alert = input.string('On', 'Alert', , 'If you turn on the Alert, you can receive alerts and notifications after setting the "Alert".', group = 'Alert')
"AlertName" : This is a string parameter where you can enter the name you choose for your alert.
AlertName = input.string('Order Blocks Finder ', 'Alert Name', group = 'Alert')
"AlertType" : The inputs for this parameter are "Bullish" or "Bearish". If the condition selected in the "Condition" parameter is of a bullish bias, you should set this parameter to "Bullish", and if the condition is of a bearish bias, it should be set to "Bearish". "AlertType" is a string parameter.
"DetectionType" : This parameter's predefined inputs include "Order Block Signal", "Signal", "Setup", and "Analysis". You may provide other inputs, but some functionalities, like "Key Price", might be lost. "DetectionType" is a string parameter.
"SetupData" :
If "DetectionType" is set to "Setup", you must specify "SetupData" as either "Basic" or "Full". In "Basic" mode, only the "Entry" price needs to be defined in the function, and "TP" (Take Profit) and "SL" (Stop Loss) can be any number or NA. In "Full" mode, you need to define "Entry", "SL", and "TP". "Setup" is a string parameter.
"Frequency" : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
Frequency = input.string('Once Per Bar', 'Message Frequency', , 'The triggering frequency. Possible values are: All (all function calls trigger the alert), Once Per Bar (the first function call during the bar triggers the alert), Per Bar Close (the function call triggers the alert only when it occurs during the last script iteration of the real-time bar, when it closes). The default is alert.freq_once_per_bar.', group = 'Alert')
"UTC" : With this parameter, you can set the Time Zone for the date and time of the alert's dispatch. "UTC" is a string parameter and can be set as "UTC-4", "UTC+1", "UTC+9", or any other Time Zone.
UTC = input.string('UTC', 'Show Alert time by Time Zone', group = 'Alert')
"MoreInfo" : This parameter can take one of two inputs, "On" or "Off", which are strings. Additional information, including "Time" and "Key Price", is included. If set to "On", this information is received; if "Off", it is not displayed in the sent message.
MoreInfo = input.string('On', 'Display More Info', , group = 'Alert')
"Message" : This parameter captures the user's personal message through an input and displays it at the end of the sent message. It is a string input.
MessageBull = input.text_area('Long Position', 'Long Signal Message', group = 'Alert') MessageBear = input.text_area('Short Position', 'Short Signal Message', group = 'Alert')
"o" (Open Price): A floating-point number representing the opening price of the candle. This input is necessary when the "DetectionType" is set to "Signal". Otherwise, it can be any number or "na".
"h" (High Price): A float variable for the highest price of the candle. Required when "DetectionType" is "Signal"; in other cases, any number or "na" is acceptable.
"l" (Low Price): A float representing the lowest price of the candle. This field must be filled if "DetectionType" is "Signal". If not, it can be any number or "na".
"c" (Close Price): A floating-point variable indicating the closing price of the candle. Needed for "Signal" type detections; otherwise, it can take any value or "na".
"Entry" : A float variable indicating the entry price into a trading setup. This is relevant when "DetectionType" is in "Setup" mode. In other scenarios, it can be any number or "na". It denotes the price at which the trade setup is entered.
"TP" (Take Profit): A float that is necessary when "DetectionType" is "Setup" and "SetupData" is "Full". Otherwise, it can be any number or "na". It signifies the price target for taking profits in a trading setup.
"SL" (Stop Loss): A float required when "DetectionType" is "Setup" and "SetupData" is "Full". It can be any number or "na" in other cases. This value represents the price at which a stop loss is set to limit losses.
"Distal" : A float important for "Order Block Signal" detection. It can be any number or "na" if not in use. This variable indicates the price reaching the distal line of an order block.
"Proximal" : A float needed for "Order Block Signal" detection mode. It can take any value or "na" otherwise. It marks the price reaching the proximal line of an order block.
footpint_drovingLibrary "footpint_droving"
methods for printing all footprint objects
method print_droving(foot_bar, sup)
printing all footprint objects
Namespace types: footprint_type.Footprint_bar
Parameters:
foot_bar (Footprint_bar type from dboichenko/footprint_type/1) : instance of Footprint_bar type
sup (Support_objects type from dboichenko/footprint_type/1) : instance of Support_objects type
Returns: Void.