holidays_2005to2010Library "holidays_2005to2010"
This dataset is part of my "MarketHolidays" library. The datasets were split into different libraries to overcome compiling limitations, streamline the process of removing specific time frames if not needed, and to enhance code execution speed. The timestamps are generated using a custom Python script that employs the 'pandas_market_calendars' library. To build your own set of arrays, you can find the script and instructions at github.com
holidays(_country)
Parameters:
_country (string)
Timesessions
holidays_2000to2005Library "holidays_2000to2005"
This dataset is part of my "MarketHolidays" library. The datasets were split into different libraries to overcome compiling limitations, streamline the process of removing specific time frames if not needed, and to enhance code execution speed. The timestamps are generated using a custom Python script that employs the 'pandas_market_calendars' library. To build your own set of arrays, you can find the script and instructions at github.com
holidays(_country)
Parameters:
_country (string)
holidays_1990to2000Library "holidays_1990to2000"
This dataset is part of my "MarketHolidays" library. The datasets were split into different libraries to overcome compiling limitations, streamline the process of removing specific time frames if not needed, and to enhance code execution speed. The timestamps are generated using a custom Python script that employs the 'pandas_market_calendars' library. To build your own set of arrays, you can find the script and instructions at github.com
holidays(_country)
Parameters:
_country (string)
holidays_1980to1990Library "holidays_1980to1990"
This dataset is part of my "MarketHolidays" library. The datasets were split into different libraries to overcome compiling limitations, streamline the process of removing specific time frames if not needed, and to enhance code execution speed. The timestamps are generated using a custom Python script that employs the 'pandas_market_calendars' library. To build your own set of arrays, you can find the script and instructions at github.com
holidays(_country)
Parameters:
_country (string)
holidays_1970to1980Library "holidays_1970to1980"
This dataset is part of my "MarketHolidays" library. The datasets were split into different libraries to overcome compiling limitations, streamline the process of removing specific time frames if not needed, and to enhance code execution speed. The timestamps are generated using a custom Python script that employs the 'pandas_market_calendars' library. To build your own set of arrays, you can find the script and instructions at github.com
holidays(_country)
Parameters:
_country (string)
holidays_1962to1970Library "holidays_1962to1970"
This dataset is part of my "MarketHolidays" library. The datasets were split into different libraries to overcome compiling limitations, streamline the process of removing specific time frames if not needed, and to enhance code execution speed. The timestamps are generated using a custom Python script that employs the 'pandas_market_calendars' library. To build your own set of arrays, you can find the script and instructions at github.com
holidays(_country)
Parameters:
_country (string)
chrono_utilsLibrary "chrono_utils"
📝 Description
Collection of objects and common functions that are related to datetime windows session days and time ranges. The main purpose of this library is to handle time-related functionality and make it easy to reason about a future bar checking if it will be part of a predefined session and/or inside a datetime window. All existing session functionality I found in the documentation e.g. "not na(time(timeframe, session, timezone))" are not suitable for strategy scripts, since the execution of the orders is delayed by one bar, due to the script execution happening at the bar close. Moreover, a history operator with a negative value that looks forward is not allowed in any pinescript expression. So, a prediction for the next bar using the bars_back argument of "time()"" and "time_close()" was necessary. Thus, I created this library to overcome this small but very important limitation. In the meantime, I added useful functionality to handle session-based behavior. An interesting utility that emerged from this development is data anomaly detection where a comparison between the prediction and the actual value is happening. If those two values are different then a data inconsistency happens between the prediction bar and the actual bar (probably due to a holiday, half session day, a timezone change etc..)
🤔 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/chrono_utils/2 as chr
To check if a future bar will be inside a window first of all you have to initialize a DateTimeWindow object.
A code example is the following:
var dateTimeWindow = chr.DateTimeWindow.new().init(fromDateTime = timestamp('01 Jan 2023 00:00'), toDateTime = timestamp('01 Jan 2024 00:00'))
Then you have to "ask" the dateTimeWindow if the future bar defined by an offset (default is 1 that corresponds th the next bar), will be inside that window:
// Filter bars outside of the datetime window
bool dateFilterApproval = dateTimeWindow.is_bar_included()
You can visualize the result by drawing the background of the bars that are outside the given window:
bgcolor(color = dateFilterApproval ? na : color.new(color.fuchsia, 90), offset = 1, title = 'Datetime Window Filter')
In the same way, you can "ask" the Session if the future bar defined by an offset it will be inside that session.
First of all, you should initialize a Session object.
A code example is the following:
var sess = chr.Session.new().from_sess_string(sess = '0800-1700:23456', refTimezone = 'UTC')
Then check if the given bar defined by the offset (default is 1 that corresponds th the next bar), will be inside the session like that:
// Filter bars outside the sessions
bool sessionFilterApproval = view.sess.is_bar_included()
You can visualize the result by drawing the background of the bars that are outside the given session:
bgcolor(color = sessionFilterApproval ? na : color.new(color.red, 90), offset = 1, title = 'Session Filter')
In case you want to visualize multiple session ranges you can create a SessionView object like that:
var view = SessionView.new().init(SessionDays.new().from_sess_string('2345'), array.from(SessionTimeRange.new().from_sess_string('0800-1600'), SessionTimeRange.new().from_sess_string('1300-2200')), array.from('London', 'New York'), array.from(color.blue, color.orange))
and then call the draw method of the SessionView object like that:
view.draw()
🏋️♂️ Please refer to the "EXAMPLE DATETIME WINDOW FILTER" and "EXAMPLE SESSION FILTER" regions of the script for more advanced code examples of how to utilize the full potential of this library, including user input settings and advanced visualization!
⚠️ Caveats
As I mentioned in the description there are some cases that the prediction of the next bar is not accurate. A wrong prediction will affect the outcome of the filtering. The main reasons this could happen are the following:
Public holidays when the market is closed
Half trading days usually before public holidays
Change in the daylight saving time (DST)
A data anomaly of the chart, where there are missing and/or inconsistent data.
A bug in this library (Please report by PM sending the symbol, timeframe, and settings)
Special thanks to @robbatt and @skinra for the constructive feedback 🏆. Without them, the exposed API of this library would be very lengthy and complicated to use. Thanks to them, now the user of this library will be able to get the most, with only a few lines of code!
SessionVolumeProfileLibrary "SessionVolumeProfile"
Analyzes price & volume during regular trading hours to provide a session volume profile analysis. The primary goal of this library is to provide the developer with three values: the value area high, low and the point of control. The library also provides methods for rendering the value areas and histograms. To learn more about this library and how you can use it, click on the website link in my profile where you will find a blog post with detailed information.
debug(vp, position)
Helper function to write some information about the supplied SVP object to the screen in a table.
Parameters:
vp (Object) : The SVP object to debug
position (string) : The position.* to place the table. Defaults to position.bottom_center
getLowerTimeframe()
Depending on the timeframe of the chart, determines a lower timeframe to grab volume data from for the analysis
Returns: The timeframe string to fetch volume for
get(volumeProfile, lowerTimeframeHigh, lowerTimeframeLow, lowerTimeframeVolume)
Populated the provided SessionVolumeProfile object with vp data on the session.
Parameters:
volumeProfile (Object) : The SessionVolumeProfile object to populate
lowerTimeframeHigh (float ) : The lower timeframe high values
lowerTimeframeLow (float ) : The lower timeframe low values
lowerTimeframeVolume (float ) : The lower timeframe volume values
drawPriorValueAreas(todaySessionVolumeProfile, extendYesterdayOverToday, showLabels, labelSize, pocColor, pocStyle, pocWidth, vahlColor, vahlStyle, vahlWidth, vaColor)
Given a SessionVolumeProfile Object, will render the historical value areas for that object.
Parameters:
todaySessionVolumeProfile (Object) : The SessionVolumeProfile Object to draw
extendYesterdayOverToday (bool) : Defaults to true
showLabels (bool) : Defaults to true
labelSize (string) : Defaults to size.small
pocColor (color) : Defaults to #e500a4
pocStyle (string) : Defaults to line.style_solid
pocWidth (int) : Defaults to 1
vahlColor (color) : The color of the value area high/low lines. Defaults to #1592e6
vahlStyle (string) : The style of the value area high/low lines. Defaults to line.style_solid
vahlWidth (int) : The width of the value area high/low lines. Defaults to 1
vaColor (color) : The color of the value area background. Defaults to #00bbf911)
drawHistogram(volumeProfile, bgColor, showVolumeOnHistogram)
Given a SessionVolumeProfile object, will render the histogram for that object.
Parameters:
volumeProfile (Object) : The SessionVolumeProfile object to draw
bgColor (color) : The baseline color to use for the histogram. Defaults to #00bbf9
showVolumeOnHistogram (bool) : Show the volume amount on the histogram bars. Defaults to false.
Object
Fields:
numberOfRows (series__integer)
valueAreaCoverage (series__integer)
trackDevelopingVa (series__bool)
valueAreaHigh (series__float)
pointOfControl (series__float)
valueAreaLow (series__float)
startTime (series__integer)
endTime (series__integer)
dayHigh (series__float)
dayLow (series__float)
step (series__float)
pointOfControlLevel (series__integer)
valueAreaHighLevel (series__integer)
valueAreaLowLevel (series__integer)
volumeRows (array__float)
priceLevelRows (array__float)
ltfSessionHighs (array__float)
ltfSessionLows (array__float)
ltfSessionVols (array__float)
CalendarCadLibrary "CalendarCad"
This library provides date and time data of the important events on CAD. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
HighImpactNews2015To2023()
CAD high impact news date and time from 2015 to 2023
CalendarEurLibrary "CalendarEur"
This library provides date and time data of the important events on EUR. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
HighImpactNews2015To2019()
EUR high impact news date and time from 2015 to 2019
HighImpactNews2020To2023()
EUR high impact news date and time from 2020 to 2023
CalendarGbpLibrary "CalendarGbp"
This library provides date and time data of the important events on GBP. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
HighImpactNews2015To2019()
GBP high impact news date and time from 2015 to 2019
HighImpactNews2020To2023()
GBP high impact news date and time from 2020 to 2023
CalendarJpyLibrary "CalendarJpy"
This library provides date and time data of the important events on JPY. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
HighImpactNews2015To2023()
JPY high impact news date and time from 2015 to 2023
CalendarUsdLibrary "CalendarUsd"
This library provides date and time data of the important events on USD. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
HighImpactNews2015To2019()
USD high impact news date and time from 2015 to 2019
HighImpactNews2020To2023()
USD high impact news date and time from 2020 to 2023
NewsEventsGbpLibrary "NewsEventsGbp"
This library provides date and time data of the high imact news events on GBP. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
gbpNews2015To2019()
GBP high imact news date and time from 2015 to 2019
gbpNews2020To2023()
GBP high imact news date and time from 2020 to 2023
NewsEventsEurLibrary "NewsEventsEur"
This library provides date and time data of the high imact news events on EUR. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
eurNews2015To2019()
EUR high imact news date and time from 2015 to 2019
eurNews2020To2023()
EUR high imact news date and time from 2020 to 2023
NewsEventsJpyLibrary "NewsEventsJpy"
This library provides date and time data of the high imact news events on JPY. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
jpyNews2015To2023()
JPY high imact news date and time from 2015 to 2023
NewsEventsCadLibrary "NewsEventsCad"
This library provides date and time data of the high imact news events on CAD. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
cadNews2015To2023()
CAD high imact news date and time from 2015 to 2023
NewsEventsUsdLibrary "NewsEventsUsd"
This library provides date and time data of the high imact news events on USD. Data source is csv exported from www.fxstreet.com and transformed into perfered format by C# script.
usdNews2015To2019()
USD high imact news date and time from 2015 to 2019
usdNews2020To2023()
USD high imact news date and time from 2020 to 2023
lib_trackingLibrary "lib_tracking"
tracking highest and lowest with anchor point to track over dynamic periods, e.g. to track a Session HH/LL live and get the bar/time of the LTF wick that matches the HTF HH/LL
// DESIGN DECISION
// why anchored replacements for ta.highest / ta.highestbars / ta.lowest / ta.lowestbars:
// 1. they require a fixed length/lookback which makes it easier to calculate, but
// 2. this prevents us from tracking the HH/LL of a changing timeframe, e.g. live tracking the HH/LL of a running session or unfinished higher timeframe
// 3. tracking with anchor/start/reset flag allows to persist values until the next start/reset, so no other external storage is required
track_highest(value, reset, track_this_bar)
Parameters:
value (float)
reset (bool) : boolean flag to restart tracking from this point (a.k.a anchor)
track_this_bar (bool) : allows enabling and disabling of tracking, e.g. before a session starts or after it ends, values can be kept until next reset.
track_lowest(value, reset, track_this_bar)
Parameters:
value (float)
reset (bool) : boolean flag to restart tracking from this point (a.k.a anchor)
track_this_bar (bool) : allows enabling and disabling of tracking, e.g. before a session starts or after it ends, values can be kept until next reset.
track_hl_htf(htf, value_high, value_low)
Parameters:
htf (string) : the higher timeframe in pinescript string notation
value_high (float)
value_low (float)
Returns:
RelativeValue█ OVERVIEW
This library is a Pine Script™ programmer's tool offering the ability to compute relative values, which represent comparisons of current data points, such as volume, price, or custom indicators, with their analogous historical data points from corresponding time offsets. This approach can provide insightful perspectives into the intricate dynamics of relative market behavior over time.
█ CONCEPTS
Relative values
In this library, a relative value is a metric that compares a current data point in a time interval to an average of data points with corresponding time offsets across historical periods. Its purpose is to assess the significance of a value by considering the historical context within past time intervals.
For instance, suppose we wanted to calculate relative volume on an hourly chart over five daily periods, and the last chart bar is two hours into the current trading day. In this case, we would compare the current volume to the average of volume in the second hour of trading across five days. We obtain the relative volume value by dividing the current volume by this average.
This form of analysis rests on the hypothesis that substantial discrepancies or aberrations in present market activity relative to historical time intervals might help indicate upcoming changes in market trends.
Cumulative and non-cumulative values
In the context of this library, a cumulative value refers to the cumulative sum of a series since the last occurrence of a specific condition (referred to as `anchor` in the function definitions). Given that relative values depend on time, we use time-based conditions such as the onset of a new hour, day, etc. On the other hand, a non-cumulative value is simply the series value at a specific time without accumulation.
Calculating relative values
Four main functions coordinate together to compute the relative values: `maintainArray()`, `calcAverageByTime()`, `calcCumulativeSeries()`, and `averageAtTime()`. These functions are underpinned by a `collectedData` user-defined type (UDT), which stores data collected since the last reset of the timeframe along with their corresponding timestamps. The relative values are calculated using the following procedure:
1. The `averageAtTime()` function invokes the process leveraging all four of the methods and acts as the main driver of the calculations. For each bar, this function adds the current bar's source and corresponding time value to a `collectedData` object.
2. Within the `averageAtTime()` function, the `maintainArray()` function is called at the start of each anchor period. It adds a new `collectedData` object to the array and ensures the array size does not exceed the predefined `maxSize` by removing the oldest element when necessary. This method plays an essential role in limiting memory usage and ensuring only relevant data over the desired number of periods is in the calculation window.
3. Next, the `calcAverageByTime()` function calculates the average value of elements within the `data` field for each `collectedData` object that corresponds to the same time offset from each anchor condition. This method accounts for cases where the current index of a `collectedData` object exceeds the last index of any past objects by using the last available values instead.
4. For cumulative calculations, the `averageAtTime()` function utilizes the `isCumulative` boolean parameter. If true, the `calcCumulativeSeries()` function will track the running total of the source data from the last bar where the anchor condition was met, providing a cumulative sum of the source values from one anchor point to the next.
To summarize, the `averageAtTime()` function continually stores values with their corresponding times in a `collectedData` object for each bar in the anchor period. When the anchor resets, this object is added to a larger array. The array's size is limited by the specified number of periods to be averaged. To correlate data across these periods, time indexing is employed, enabling the function to compare corresponding points across multiple periods.
█ USING THIS LIBRARY
The library simplifies the complex process of calculating relative values through its intuitive functions. Follow the steps below to use this library in your scripts.
Step 1: Import the library and declare inputs
Import the library and declare variables based on the user's input. These can include the timeframe for each period, the number of time intervals to include in the average, and whether the calculation uses cumulative values. For example:
//@version=5
import TradingView/RelativeValue/1 as TVrv
indicator("Relative Range Demo")
string resetTimeInput = input.timeframe("D")
int lengthInput = input.int(5, "No. of periods")
Step 2: Define the anchor condition
With these inputs declared, create a condition to define the start of a new period (anchor). For this, we use the change in the time value from the input timeframe:
bool anchor = timeframe.change(resetTimeInput)
Step 3: Calculate the average
At this point, one can calculate the average of a value's history at the time offset from the anchor over a number of periods using the `averageAtTime()` function. In this example, we use True Range (TR) as the `source` and set `isCumulative` to false:
float pastRange = TVrv.averageAtTime(ta.tr, lengthInput, anchor, false)
Step 4: Display the data
You can visualize the results by plotting the returned series. These lines display the non-cumulative TR alongside the average value over `lengthInput` periods for relative comparison:
plot(pastRange, "Past True Range Avg", color.new(chart.bg_color, 70), 1, plot.style_columns)
plot(ta.tr, "True Range", close >= open ? color.new(color.teal, 50) : color.new(color.red, 50), 1, plot.style_columns)
This example will display two overlapping series of columns. The green and red columns depict the current TR on each bar, and the light gray columns show the average over a defined number of periods, e.g., the default inputs on an hourly chart will show the average value at the hour over the past five days. This comparative analysis aids in determining whether the range of a bar aligns with its typical historical values or if it's an outlier.
█ NOTES
• The foundational concept of this library was derived from our initial Relative Volume at Time script. This library's logic significantly boosts its performance. Keep an eye out for a forthcoming updated version of the indicator. The demonstration code included in the library emulates a streamlined version of the indicator utilizing the library functions.
• Key efficiencies in the data management are realized through array.binary_search_leftmost() , which offers a performance improvement in comparison to its loop-dependent counterpart.
• This library's architecture utilizes user-defined types (UDTs) to create custom objects which are the equivalent of variables containing multiple parts, each able to hold independent values of different types . The recently added feature was announced in this blog post.
• To enhance readability, the code substitutes array functions with equivalent methods .
Look first. Then leap.
█ FUNCTIONS
This library contains the following functions:
calcCumulativeSeries(source, anchor)
Calculates the cumulative sum of `source` since the last bar where `anchor` was `true`.
Parameters:
source (series float) : Source used for the calculation.
anchor (series bool) : The condition that triggers the reset of the calculation. The calculation is reset when `anchor` evaluates to `true`, and continues using the values accumulated since the previous reset when `anchor` is `false`.
Returns: (float) The cumulative sum of `source`.
averageAtTime(source, length, anchor, isCumulative)
Calculates the average of all `source` values that share the same time difference from the `anchor` as the current bar for the most recent `length` bars.
Parameters:
source (series float) : Source used for the calculation.
length (simple int) : The number of reset periods to consider for the average calculation of historical data.
anchor (series bool) : The condition that triggers the reset of the average calculation. The calculation is reset when `anchor` evaluates to `true`, and continues using the values accumulated since the previous reset when `anchor` is `false`.
isCumulative (simple bool) : If `true`, `source` values are accumulated until the next time `anchor` is `true`. Optional. The default is `true`.
Returns: (float) The average of the source series at the specified time difference.
SessionAndTimeFct_publicLibrary "SessionAndTimeFct_public"
is_in_session(sessionTime, sessionTimeZone)
: Check if actual bar is in specific session with specific time zone
Parameters:
sessionTime
sessionTimeZone
is_session_start(sessionTime, sessionTimeZone)
: Check if actual bar the first bar of a specific session
Parameters:
sessionTime
sessionTimeZone
is_new_day(timeZone)
: Check if a new day started
Parameters:
timeZone
is_new_week(timeZone)
: Check if a new week started
Parameters:
timeZone
is_new_month(timeZone)
: Check if a new month started
Parameters:
timeZone
is_element_to_show_with_tf_up(base, value)
: Check if an element is to show compared to a specific timeframe >
Parameters:
base
value
is_element_to_show_with_tf_down(base, value)
: Check if an element is to show compared to a specific timeframe <
Parameters:
base
value
FrizLabz_Time_Utility_MethodsLibrary "FrizLabz_Time_Utility_Methods"
Some time to index and index to time helper methods made them for another library thought I would try to make
them as methods
UTC_helper(utc)
UTC helper function this adds the + to the positive utc times, add "UTC" to the string
and can be used in the timezone arg of for format_time()
Parameters:
utc : (int) | +/- utc offset
Returns: string | string to be added to the timezone paramater for utc timezone usage
bar_time(bar_amount)
from a time to index
Parameters:
bar_amount : (int) | default - 1)
Returns: int bar_time
time_to_index(_time)
from time to bar_index
Parameters:
_time : (int)
Returns: int time_to_index | bar_index that corresponds to time provided
time_to_bars_back(_time)
from a time quanity to bar quanity for use with .
Parameters:
_time : (int)
Returns: int bars_back | yeilds the amount of bars from current bar to reach _time provided
bars_back_to_time(bars_back)
from bars_back to time
Parameters:
bars_back
Returns: int | using same logic as this will return the
time of the bar = to the bar that corresponds to bars_back
index_time(index)
bar_index to UNIX time
Parameters:
index : (int)
Returns: int time | time in unix that corrresponds to the bar_index
to_utc(time_or_index, timezone, format)
method to use with a time or bar_index variable that will detect if it is an index or unix time
and convert it to a printable string
Parameters:
time_or_index : (int) required) | time in unix or bar_index
timezone : (int) required) | utc offset to be appled to output
format : (string) | default - "yyyy-MM-dd'T'HH:mm:ssZ") | the format for the time, provided string is
default one from str.format_time()
Returns: string | time formatted string
GET(line)
Gets the location paramaters of a Line
Parameters:
line : (line)
Returns: tuple
GET(box)
Gets the location paramaters of a Box
Parameters:
box : (box)
Returns: tuple
GET(label)
Gets the location paramaters and text of a Label
Parameters:
label : (label)
Returns: tuple
GET(linefill)
Gets line 1 and 2 from a Linefill
Parameters:
linefill : (linefill)
Returns: tuple
Format(line, timezone)
converts Unix time in time or index params to formatted time
and returns a tuple of the params as string with the time/index params formatted
Parameters:
line : (line) | required
timezone : (int) | default - na
Returns: tuple
Line(x1, y1, x2, y2, extend, color, style, width)
similar to line.new() with the exception
of not needing to include y2 for a flat line, y1 defaults to close,
and it doesnt require xloc.bar_time or xloc.bar_index, if no x1
Parameters:
x1 : (int) default - time
y1 : (float) default - close
x2 : (int) default - last_bar_time/last_bar_index | not required for line that ends on current bar
y2 : (float) default - y1 | not required for flat line
extend : (string) default - extend.none | extend.left, extend.right, extend.both
color : (color) default - chart.fg_color
style : (string) default - line.style_solid | line.style_dotted, line.style_dashed,
line.style_arrow_both, line.style_arrow_left, line.style_arrow_right
width
Returns: line
Box(left, top, right, bottom, extend, border_color, bgcolor, text_color, border_width, border_style, txt, text_halign, text_valign, text_size, text_wrap)
similar to box.new() but only requires top and bottom to create box,
auto detects if it is bar_index or time used in the (left) arg. xloc.bar_time and xloc.bar_index are not used
args are ordered by purpose | position -> colors -> styling -> text options
Parameters:
left : (int) default - time
top : (float) required
right : (int) default - last_bar_time/last_bar_index | will default to current bar index or time
depending on (left) arg
bottom : (float) required
extend : (string) default - extend.none | extend.left, extend.right, extend.both
border_color : (color) default - chart.fg_color
bgcolor : (color) default - color.new(chart.fg_color,75)
text_color : (color) default - chart.bg_color
border_width : (int) default - 1
border_style : (string) default - line.style_solid | line.style_dotted, line.style_dashed,
txt : (string) default - ''
text_halign : (string) default - text.align_center | text.align_left, text.align_right
text_valign : (string) default - text.align_center | text.align_top, text.align_bottom
text_size : (string) default - size.normal | size.tiny, size.small, size.large, size.huge
text_wrap : (string) default - text.wrap_auto | text.wrap_none
Returns: box
Label(x, y, txt, yloc, color, textcolor, style, size, textalign, text_font_family, tooltip)
similar to label.new() but only requires no args to create label,
auto detects if it is bar_index or time used in the (x) arg. xloc.bar_time and xloc.bar_index are not used
args are ordered by purpose | position -> colors -> styling -> text options
Parameters:
x : (int) default - time
y : (float) default - high or low | depending on bar direction
txt : (string) default - ''
yloc : (string) default - yloc.price | yloc.price, yloc.abovebar, yloc.belowbar
color : (color) default - chart.fg_color
textcolor : (color) default - chart.bg_color
style : (string) default - label.style_label_down | label.style_none
label.style_xcross,label.style_cross,label.style_triangleup,label.style_triangledown
label.style_flag, label.style_circle, label.style_arrowup, label.style_arrowdown,
label.style_label_up, label.style_label_down, label.style_label_left, label.style_label_right,
label.style_label_lower_left, label.style_label_lower_right, label.style_label_upper_left,
label.style_label_upper_right, label.style_label_center, label.style_square,
label.style_diamond
size : (string) default - size.normal | size.tiny, size.small, size.large, size.huge
textalign : (string) default - text.align_center | text.align_left, text.align_right
text_font_family : (string) default - font.family_default | font.family_monospace
tooltip : (string) default - na
Returns: label