regressionsLibrary "regressions"
This library computes least square regression models for polynomials of any form for a given data set of x and y values.
fit(X, y, reg_type, degrees)
Takes a list of X and y values and the degrees of the polynomial and returns a least square regression for the given polynomial on the dataset.
Parameters:
X (array) : (float ) X inputs for regression fit.
y (array) : (float ) y outputs for regression fit.
reg_type (string) : (string) The type of regression. If passing value for degrees use reg.type_custom
degrees (array) : (int ) The degrees of the polynomial which will be fit to the data. ex: passing array.from(0, 3) would be a polynomial of form c1x^0 + c2x^3 where c2 and c1 will be coefficients of the best fitting polynomial.
Returns: (regression) returns a regression with the best fitting coefficients for the selecected polynomial
regress(reg, x)
Regress one x input.
Parameters:
reg (regression) : (regression) The fitted regression which the y_pred will be calulated with.
x (float) : (float) The input value cooresponding to the y_pred.
Returns: (float) The best fit y value for the given x input and regression.
predict(reg, X)
Predict a new set of X values with a fitted regression. -1 is one bar ahead of the realtime
Parameters:
reg (regression) : (regression) The fitted regression which the y_pred will be calulated with.
X (array)
Returns: (float ) The best fit y values for the given x input and regression.
generate_points(reg, x, y, left_index, right_index)
Takes a regression object and creates chart points which can be used for plotting visuals like lines and labels.
Parameters:
reg (regression) : (regression) Regression which has been fitted to a data set.
x (array) : (float ) x values which coorispond to passed y values
y (array) : (float ) y values which coorispond to passed x values
left_index (int) : (int) The offset of the bar farthest to the realtime bar should be larger than left_index value.
right_index (int) : (int) The offset of the bar closest to the realtime bar should be less than right_index value.
Returns: (chart.point ) Returns an array of chart points
plot_reg(reg, x, y, left_index, right_index, curved, close, line_color, line_width)
Simple plotting function for regression for more custom plotting use generate_points() to create points then create your own plotting function.
Parameters:
reg (regression) : (regression) Regression which has been fitted to a data set.
x (array)
y (array)
left_index (int) : (int) The offset of the bar farthest to the realtime bar should be larger than left_index value.
right_index (int) : (int) The offset of the bar closest to the realtime bar should be less than right_index value.
curved (bool) : (bool) If the polyline is curved or not.
close (bool) : (bool) If true the polyline will be closed.
line_color (color) : (color) The color of the line.
line_width (int) : (int) The width of the line.
Returns: (polyline) The polyline for the regression.
series_to_list(src, left_index, right_index)
Convert a series to a list. Creates a list of all the cooresponding source values
from left_index to right_index. This should be called at the highest scope for consistency.
Parameters:
src (float) : (float ) The source the list will be comprised of.
left_index (int) : (float ) The left most bar (farthest back historical bar) which the cooresponding source value will be taken for.
right_index (int) : (float ) The right most bar closest to the realtime bar which the cooresponding source value will be taken for.
Returns: (float ) An array of size left_index-right_index
range_list(start, stop, step)
Creates an from the start value to the stop value.
Parameters:
start (int) : (float ) The true y values.
stop (int) : (float ) The predicted y values.
step (int) : (int) Positive integer. The spacing between the values. ex: start=1, stop=6, step=2:
Returns: (float ) An array of size stop-start
regression
Fields:
coeffs (array__float)
degrees (array__float)
type_linear (series__string)
type_quadratic (series__string)
type_cubic (series__string)
type_custom (series__string)
_squared_error (series__float)
X (array__float)
อินดิเคเตอร์และกลยุทธ์
swinglibraryLibrary "swinglibrary"
This library is for calculating non-repainting swings for further calculation on them.
These swings can later be drawn, but drawing is not part of this library, only the calculation.
What do I need to use the library?
You better include the following constants into your script using this library:
int SWING_NO_ACTION = 0
int SWING_FLIP = 1
int SWING_FLIP_NEW_SWING = 2
int SWING_FLIP_UPDATED = 3
int RELATION_HIGHER = 1
int RELATION_EQUAL = 0
int RELATION_LOWER = -1
Choosing the function, that fits your needs
This library contains 4 functions for calculating swings, the difference between them are the data you get for every swing point and additional average values for length and duration:
swings()
swingsR()
swingsL()
swingsLDR()
The naming scheme of these functions is the following:
The base version swings() is only for the swings containing the following swingPoint type:
swingPoint
Fields:
x (integer) : bar index
y (float) : price
hilo (integer) 1 -> high, -1 -> low
and the return type:
swingReturn
Fields:
swings (array) : array of the last x swing points
newSwingHigh (integer) : flag to detect changes for swing highs see constants (SWING_NO_ACTION, SWING_FLIP_NEW_SWING, SWING_FLIP_UPDATED)
newSwingLow (integer) : flag to detect changes for swing lows see constants (SWING_NO_ACTION, SWING_FLIP_NEW_SWING, SWING_FLIP_UPDATED)
The R in swingsR() stands for relation where the previously shown types do also contain the relation between the swings of the same swing type (highs and lows respectively).
The same goes for L in swingsL() for length containing the price difference between the current and previous swing point in ticks.
And in the following version swingsLDR() there is also the duration between the current and previous point included.
The parameters for the other functions and type definitions include only the ones, that are needed, the "full" version of the function is described here:
swingsLDR(swingSize, dtbStrength, init, SWING_HISTORY_NUM)
Parameters:
swingSize (int) This parameter defines the size of the swings to look after, meaning higher values will lead to bigger swings
dtbStrength (int) Value between 0 and 100 is a factor (%) to the ATR that is used to calculate equal highs/lows (double tops / bottoms).
Higher values will result in a higher tolerance of price difference between the swings.
init (bool) This value is usually set to false on default.
It has a special use case, where we need to reduce memory usage and calculation time on the script using this library by start calculating at x bars back instead of the beginning of the chart.
In this case, we set init = true on the first bar we start calculating the swings on to perform the correct initialization.
SWING_HISTORY_NUM (int) This is the max number of swings that are stored in the array, so only the last SWING_HISTORY_NUM swings are stored in the array to reduce the memory usage.
New ones remove the oldest ones like in a ring buffer.
This is also influencing the average duration and average swing length.
swingPointLDR
Fields:
x (integer) : bar index
y (float) : price
hilo (integer) : 1 -> high, -1 -> low
length (float) : price difference to the previous swing point in ticks
duration (integer) : duration difference to the previous swing point in number of bars
relation (integer) : see constants RELATION_HIGHER, RELATION_EQUAL, RELATION_LOWER: reelation to the previous swing points of the same type (previous high or previous low respectively)
swingReturnLDR
Fields:
swings (array) : array of the last x swing points
newSwingHigh (integer) : flag to detect changes for swing highs see constants (SWING_NO_ACTION, SWING_FLIP_NEW_SWING, SWING_FLIP_UPDATED)
newSwingLow (integer) : flag to detect changes for swing lows see constants (SWING_NO_ACTION, SWING_FLIP_NEW_SWING, SWING_FLIP_UPDATED)
avSwLength (float) : average swing length for the last x swings (depending on the max number of swings)
avSwingDuration (float) : average swing duration for the last x swings (depending on the max number of swings)
MarkdownUtilsLibrary "MarkdownUtils"
This library shows all of CommonMark's formatting elements that are currently (2024-03-30)
available in Pine Script® and gives some hints on how to use them.
The documentation will be in the tooltip of each of the following functions. It is also
logged into Pine Logs by default if it is called. We can disable the logging by setting `pLog = false`.
mediumMathematicalSpace()
Medium mathematical space that can be used in e.g. the library names like `Markdown Utils`.
Returns: The medium mathematical space character U+205F between those double quotes " ".
zeroWidthSpace()
Zero-width space.
Returns: The zero-width character U+200B between those double quotes "".
stableSpace(pCount)
Consecutive space characters in Pine Script® are replaced by a single space character on output.
Therefore we require a "stable" space to properly indent text e.g. in Pine Logs. To use it in code blocks
of a description like this one, we have to copy the 2(!) characters between the following reverse brackets instead:
# > <
Those are the zero-width character U+200B and a space.
Of course, this can also be used within a text to add some extra spaces.
Parameters:
pCount (simple int)
Returns: A zero-width space combined with a space character.
headers(pLog)
Headers
```
# H1
## H2
### H3
#### H4
##### H5
###### H6
```
*results in*
# H1
## H2
### H3
#### H4
##### H5
###### H6
*Best practices*: Add blank line before and after each header.
Parameters:
pLog (bool)
paragrahps(pLog)
Paragraphs
```
First paragraph
Second paragraph
```
*results in*
First paragraph
Second paragraph
Parameters:
pLog (bool)
lineBreaks(pLog)
Line breaks
```
First row
Second row
```
*results in*
First row\
Second row
Parameters:
pLog (bool)
emphasis(pLog)
Emphasis
With surrounding `*` and `~` we can emphasize text as follows. All emphasis can be arbitrarily combined.
```
*Italics*, **Bold**, ***Bold italics***, ~~Scratch~~
```
*results in*
*Italics*, **Bold**, ***Bold italics***, ~~Scratch~~
Parameters:
pLog (bool)
blockquotes(pLog)
Blockquotes
Lines starting with at least one `>` followed by a space and text build block quotes.
```
Text before blockquotes.
> 1st main blockquote
>
> 1st main blockquote
>
>> 1st 1-nested blockquote
>
>>> 1st 2-nested blockquote
>
>>>> 1st 3-nested blockquote
>
>>>>> 1st 4-nested blockquote
>
>>>>>> 1st 5-nested blockquote
>
>>>>>>> 1st 6-nested blockquote
>
>>>>>>>> 1st 7-nested blockquote
>
> 2nd main blockquote, 1st paragraph, 1st row\
> 2nd main blockquote, 1st paragraph, 2nd row
>
> 2nd main blockquote, 2nd paragraph, 1st row\
> 2nd main blockquote, 2nd paragraph, 2nd row
>
>> 2nd nested blockquote, 1st paragraph, 1st row\
>> 2nd nested blockquote, 1st paragraph, 2nd row
>
>> 2nd nested blockquote, 2nd paragraph, 1st row\
>> 2nd nested blockquote, 2nd paragraph, 2nd row
Text after blockquotes.
```
*results in*
Text before blockquotes.
> 1st main blockquote
>
>> 1st 1-nested blockquote
>
>>> 1st 2-nested blockquote
>
>>>> 1st 3-nested blockquote
>
>>>>> 1st 4-nested blockquote
>
>>>>>> 1st 5-nested blockquote
>
>>>>>>> 1st 6-nested blockquote
>
>>>>>>>> 1st 7-nested blockquote
>
> 2nd main blockquote, 1st paragraph, 1st row\
> 2nd main blockquote, 1st paragraph, 2nd row
>
> 2nd main blockquote, 2nd paragraph, 1st row\
> 2nd main blockquote, 2nd paragraph, 2nd row
>
>> 2nd nested blockquote, 1st paragraph, 1st row\
>> 2nd nested blockquote, 1st paragraph, 2nd row
>
>> 2nd nested blockquote, 2nd paragraph, 1st row\
>> 2nd nested blockquote, 2nd paragraph, 2nd row
Text after blockquotes.
*Best practices*: Add blank line before and after each (nested) blockquote.
Parameters:
pLog (bool)
lists(pLog)
Paragraphs
#### Ordered lists
The first line starting with a number combined with a delimiter `.` or `)` starts an ordered
list. The list's numbering starts with the given number. All following lines that also start
with whatever number and the same delimiter add items to the list.
#### Unordered lists
A line starting with a `-`, `*` or `+` becomes an unordered list item. All consecutive items with
the same start symbol build a separate list. Therefore every list can only have a single symbol.
#### General information
To start a new list either use the other delimiter or add some non-list text between.
List items in Pine Script® allow line breaks but cannot have paragraphs or blockquotes.
Lists Pine Script® cannot be nested.
```
1) 1st list, 1st item, 1st row\
1st list, 1st item, 2nd row
1) 1st list, 2nd item, 1st row\
1st list, 2nd item, 2nd row
1) 1st list, 2nd item, 1st row\
1st list, 2nd item, 2nd row
1. 2nd list, 1st item, 1st row\
2nd list, 1st item, 2nd row
Intermediary text.
1. 3rd list
Intermediary text (sorry, unfortunately without proper spacing).
8. 4th list, 8th item
8. 4th list, 9th item
Intermediary text.
- 1st list, 1st item
- 1st list, 2nd item
* 2nd list, 1st item
* 2nd list, 2nd item
Intermediary text.
+ 3rd list, 1st item
+ 3rd list, 2nd item
```
*results in*
1) 1st list, 1st item, 1st row\
1st list, 1st item, 2nd row
1) 1st list, 2nd item, 1st row\
1st list, 2nd item, 2nd row
1) 1st list, 2nd item, 1st row\
1st list, 2nd item, 2nd row
1. 2nd list, 1st item, 1st row\
2nd list, 1st item, 2nd row
Intermediary text.
1. 3rd list
Intermediary text (sorry, unfortunately without proper spacing).
8. 4th list, 8th item
8. 4th list, 9th item
Intermediary text.
- 1st list, 1st item
- 1st list, 2nd item
* 2nd list, 1st item
* 2nd list, 2nd item
Intermediary text.
+ 3rd list, 1st item
+ 3rd list, 2nd item
Parameters:
pLog (bool)
code(pLog)
### Code
`` `Inline code` `` is formatted like this.
To write above line we wrote `` `` `Inline code` `` ``.
And to write that line we added another pair of `` `` `` around that code and
a zero-width space of function between the inner `` `` ``.
### Code blocks
can be formatted like that:
~~~
```
export method codeBlock() =>
"code block"
```
~~~
Or like that:
```
~~~
export method codeBlock() =>
"code block"
~~~
```
To write ````` within a code block we can either surround it with `~~~`.
Or we "escape" those ````` by only the zero-width space of function (stableSpace) in between.
To escape \` within a text we use `` \` ``.
Parameters:
pLog (bool)
horizontalRules(pLog)
Horizontal rules
At least three connected `*`, `-` or `_` in a separate line build a horizontal rule.
```
Intermediary text.
---
Intermediary text.
***
Intermediary text.
___
Intermediary text.
```
*results in*
Intermediary text.
---
Intermediary text.
***
Intermediary text.
___
Intermediary text.
*Best practices*: Add blank line before and after each horizontal rule.
Parameters:
pLog (bool)
tables(pLog)
Tables
A table consists of a single header line with columns separated by `|`
and followed by a row of alignment indicators for either left (`---`, `:---`), centered (`:---:`) and right (`---:`)
A table can contain several rows of data.
The table can be written as follows but hasn't to be formatte like that. By adding (stableSpace)
on the correct side of the header we could even adjust the spacing if we don't like it as it is. Only around
the column separator we should only use a usual space on each side.
```
Header 1 | Header 1 | Header 2 | Header 3
--- | :--- | :----: | ---:
Left (Default) | Left | Centered | Right
Left (Default) | Left | Centered | Right
```
*results in*
Header 1 | Header 1 | Header 2 | Header 3
--- | :--- | :----: | ---:
Left (Default) | Left | Centered | Right
Left (Default) | Left | Centered | Right
Parameters:
pLog (bool)
links(pLog)
## Links.
### Inline-style
` (Here should be the link to the TradingView homepage)`\
results in (Here should be the link to the TradingView homepage)
` (Here should be the link to the TradingView homepage "Trading View tooltip")`\
results in (Here should be the link to the TradingView homepage "Trading View tooltip")
### Reference-style
One can also collect all links e.g. at the end of a description and use a reference to that as follows.
` `\
results in .
` `\
results in .
` `\
results in .
` (../tradingview/scripts/readme)`\
results in (../tradingview/scripts/readme).
### URLs and email
URLs are also identified by the protocol identifier, email addresses by `@`. They can also be surrounded by `<` and `>`.
Input | Result
--- | ---
`Here should be the link to the TradingView homepage` | Here should be the link to the TradingView homepage
`` |
`support@tradingview.com` | support@tradingview.com
`` |
## Images
We can display gif, jp(e)g and png files in our documentation, if we add `!` before a link.
### Inline-style:
`! (Here should be the link to the favicon of the TradingView homepage "Trading View icon")`
results in
! (Here should be the link to the favicon of the TradingView homepage "Trading View icon")\
### Reference-style:
`! `
results in
!
## References for reference-style links
Even though only the formatted references are visible here in the output, this text is also followed
by the following references with links in the style
` : Referenced link`
```
: Here should be the link to the TradingView homepage "Trading view text-reference tooltip"
: Here should be the link to the TradingView homepage "Trading view number-reference tooltip"
: Here should be the link to the TradingView homepage "Trading view self-reference tooltip"
: Here should be the link to the favicon of the TradingView homepage "Trading View icon (reference)"
```
: Here should be the link to the TradingView homepage "Trading view text-reference tooltip"
: Here should be the link to the TradingView homepage "Trading view number-reference tooltip"
: Here should be the link to the TradingView homepage "Trading view self-reference tooltip"
: Here should be the link to the favicon of the TradingView homepage "Trading View icon (reference)"
Parameters:
pLog (bool)
taskLists(pLog)
Task lists.
Other Markdown implementations can also display task lists for list items like `- ` respective `- `.
This can only be simulated by inline code `` ´ ` ``.
Make sure to either add a line-break `\` at the end of the line or a new paragraph by a blank line.
### Task lists
` ` Finish library
` ` Finish library
Parameters:
pLog (bool)
escapeMd(pLog)
Escaping Markdown syntax
To write and display Markdown syntax in regular text, we have to escape it. This can be done
by adding `\` before the Markdown syntax. If the Markdown syntax consists of more than one character
in some cases also the character of function can be helpful if a command consists of
more than one character if it is placed between the separate characters of the command.
Parameters:
pLog (bool)
test()
Calls all functions of above script.
DeleteArrayType█ OVERVIEW
Here are common functions usually delete drawing once array of drawing is recall.
Method is used as in pine script version 5 instead of custom function.
It is an upgrade from DeleteArrayObject , which may not support overload parameter in future.
Library "DeleteArrayType"
TODO: Delete array type especially for drawings
method deleteLabel(id)
TODO: Delete array
Namespace types: array
Parameters:
id (array)
Returns: TODO: label.delete()
method deleteLine(id)
TODO: Delete array
Namespace types: array
Parameters:
id (array)
Returns: TODO: line.delete()
method deleteLineFill(id)
TODO: Delete array
Namespace types: array
Parameters:
id (array)
Returns: TODO: linefill.delete()
method deletePolyLine(id)
TODO: Delete array
Namespace types: array
Parameters:
id (array)
Returns: TODO: polyline.delete()
method deleteBox(id)
TODO: Delete array
Namespace types: array
Parameters:
id (array)
Returns: TODO: box.delete()
method deleteTable(id)
TODO: Delete array
Namespace types: array
Parameters:
id (array)
Returns: TODO: table.delete()
YPLibrary "YP"
TODO: add library description here
breakUp(previousHigh)
breakUp: Determines if the low of the first bar of the current day
is above a given previous high.
Parameters:
previousHigh (float)
Returns: : Boolean value indicating whether the condition is met (true) or not (false).
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.
AdaptivePNLLibrary "Adaptive Profit And Loss"
Provide Take profit and Stop loss values depending on source.
TakeProfitPriceTypes()
Provides supported Take profit sources
Returns: Supported Take profit sources
StopLossPriceTypes()
Provides supported Take profit sources
Returns: Supported Take profit sources
Price(type)
Get price value by selected price type
Parameters:
type (string) : price type from @TakeProfitPriceTypes() or @StopLossPriceTypes()
Returns: Required price value.
LinearProfit(initPerc, stepPerc)
Lineary changed profit
Parameters:
initPerc (float) : Initial profit value in percent unit
stepPerc (float) : Amount of change per every bar since last entry. Posiitive value will decrease profit in time.
Returns: Profit value lineary increased/decreased since last entry. If there is no opened trade, value is NaN
AdaptedProfit(initPerc, stepPerc, source)
Profit adapted to lowest/highest value of given source and lineary changes after it
Parameters:
initPerc (float) : Initial profit value in percent unit
stepPerc (float) : Amount of change per every bar since last entry. Posiitive value will decrease profit in time.
source (float) : Source according to is profit adapted. If it reach high, profit is increased for long positions, same for low and short positions.
Returns: Profit value lineary increased/decreased and adjusted since last entry. If there is no active trade, value is NaN
LinearStopLoss(initPerc, stepPerc)
Lineary changed stop loss
Parameters:
initPerc (float) : Initial stop loss value in percent unit
stepPerc (float) : Amount of change per every bar since last entry. Posiitive value will increase stop loss in time.
Returns: Stop loss value lineary increased/decreased since last entry. If there is no opened trade, value is NaN
AdaptedStopLoss(initPerc, stepPerc, source)
Stop loss adapted to highest/lowest value of given source and lineary changes after it
Parameters:
initPerc (float) : Initial stop loss value in percent unit
stepPerc (float) : Amount of change per every bar since last entry. Posiitive value will increase stop loss in time.
source (float) : Source according to is stop loss adapted. If it reach high, stop loss is increased for long positions, same for low and short positions.
Returns: Stop loss value lineary increased/decreased and adjusted since last entry. If there is no active trade, value is NaN
LibraryCOT_NZLibrary "LibraryCOT_NZ"
This library provides tools to help Pine programmers fetch Commitment of Traders (COT) data for futures.
rootToCFTCCode(root)
Accepts a futures root and returns the relevant CFTC code.
Parameters:
root (simple string) : Root prefix of the future's symbol, e.g. "ZC" for "ZC1!"" or "ZCU2021".
Returns: The part of a COT ticker corresponding to `root`, or "" if no CFTC code exists for the `root`.
currencyToCFTCCode(currency)
Converts a currency string to its corresponding CFTC code.
Parameters:
currency (simple string)
Returns: The corresponding to the currency, if one exists.
optionsToTicker(includeOptions)
Returns the part of a COT ticker using the `includeOptions` value supplied, which determines whether options data is to be included.
Parameters:
includeOptions (simple bool) : A "bool" value: 'true' if the symbol should include options and 'false' otherwise.
Returns: The part of a COT ticker: "FO" for data that includes options and "F" for data that doesn't.
metricNameAndDirectionToTicker(metricName, metricDirection)
Returns a string corresponding to a metric name and direction, which is one component required to build a valid COT ticker ID.
Parameters:
metricName (simple string) : One of the metric names listed in this library's chart. Invalid values will cause a runtime error.
metricDirection (simple string) : Metric direction. Possible values are: "Long", "Short", "Spreading", and "No direction". Valid values vary with metrics. Invalid values will cause a runtime error.
Returns: The part of a COT ticker ID string, e.g., "OI_OLD" for "Open Interest" and "No direction", or "TC_L" for "Traders Commercial" and "Long".
typeToTicker(metricType)
Converts a metric type into one component required to build a valid COT ticker ID. See the "Old and Other Futures" section of the CFTC's Explanatory Notes for details on types.
Parameters:
metricType (simple string) : Metric type. Accepted values are: "All", "Old", "Other".
Returns: The part of a COT ticker.
convertRootToCOTCode(mode, convertToCOT)
Depending on the `mode`, returns a CFTC code using the chart's symbol or its currency information when `convertToCOT = true`. Otherwise, returns the symbol's root or currency information. If no COT data exists, a runtime error is generated.
Parameters:
mode (simple string) : A string determining how the function will work. Valid values are:
"Root": the function extracts the futures symbol root (e.g. "ES" in "ESH2020") and looks for its CFTC code.
"Base currency": the function extracts the first currency in a pair (e.g. "EUR" in "EURUSD") and looks for its CFTC code.
"Currency": the function extracts the quote currency ("JPY" for "TSE:9984" or "USDJPY") and looks for its CFTC code.
"Auto": the function tries the first three modes (Root -> Base Currency -> Currency) until a match is found.
convertToCOT (simple bool) : "bool" value that, when `true`, causes the function to return a CFTC code. Otherwise, the root or currency information is returned. Optional. The default is `true`.
Returns: If `convertToCOT` is `true`, the part of a COT ticker ID string. If `convertToCOT` is `false`, the root or currency extracted from the current symbol.
COTTickerid(COTType, CFTCCode, includeOptions, metricName, metricDirection, metricType)
Returns a valid TradingView ticker for the COT symbol with specified parameters.
Parameters:
COTType (simple string) : A string with the type of the report requested with the ticker, one of the following: "Legacy", "Disaggregated", "Financial".
CFTCCode (simple string)
includeOptions (simple bool) : A boolean value. 'true' if the symbol should include options and 'false' otherwise.
metricName (simple string) : One of the metric names listed in this library's chart.
metricDirection (simple string) : Direction of the metric, one of the following: "Long", "Short", "Spreading", "No direction".
metricType (simple string) : Type of the metric. Possible values: "All", "Old", and "Other".
Returns: A ticker ID string usable with `request.security()` to fetch the specified Commitment of Traders data.
EagleEyeEmbedsLibrary "EagleEyeEmbeds"
Pine Script library to build out a webhook that is catered to Discord Embed
formatTimeframe()
discordWebhookJSON(contentText, username, avatar_url, embeds)
Constructs a JSON string for a Discord webhook message. This string includes optional fields for content, username, avatar URL, and embeds.
Parameters:
contentText (string) : (string, optional): The main text content of the webhook message. Default is 'na'.
username (string) : (string, optional): Overrides the default username of the webhook. Default is 'na'.
avatar_url (string) : (string, optional): Overrides the default avatar URL of the webhook. Default is 'na'.
embeds (string) : (string, optional): A string containing one or more embed JSON objects. This should be formatted correctly as a JSON array. Default is 'na'.
createEmbedJSON(title, description, url, thumbImgUrl, color, authorName, authorUrl, authorIconUrl, fields, imageUrl, timeStamp, footerText, footerIconUrl)
Creates a JSON string for a single embed object for a Discord webhook.
Parameters:
title (string) : (string, optional): The title of the embed. Default is 'na' (not applicable).
description (string) : (string, optional): The description text of the embed. Supports basic formatting. Default is 'na'.
url (string)
thumbImgUrl (string)
color (int) : (int, optional): The color code of the embed, typically in decimal format. Default is 'na'.
authorName (string) : (string, optional): The name of the author to display in the embed. Default is 'na'.
authorUrl (string) : (string, optional): The URL linked to the author's name. Default is 'na'.
authorIconUrl (string) : (string, optional): The URL of the icon to display next to the author's name. Default is 'na'.
fields (string) : (string, optional): A string containing one or more field JSON objects. This should be formatted correctly as a JSON array. Default is 'na'. Note: Use the 'createEmbedFieldJSON' function to generate these JSON field strings before adding them to the array.
imageUrl (string)
timeStamp (string)
footerText (string) : (string, optional): The footer text to display in the embed.
footerIconUrl (string) : (string, optional): The URL of the icon to display next to the footer text.
createEmbedFieldJSON(name, value, inline)
Creates a JSON string representing a single field object within an embed for a Discord webhook message.
Parameters:
name (string) : (string): The name of the field, acting as a title for the field content.
value (string) : (string): The value of the field, containing the actual text or information you want to display within the field.
inline (bool) : (bool, optional): A boolean flag indicating whether the field should be displayed inline with other fields. If set to true, the field will be displayed on the same line as the next field
Multi conditions matricesLibrary "multi_conditions_matrices"
: facilitate including multiple AND / OR conditions to a script such as two entry / exit inputs groups.
method addConditions(conditions, conditionPair)
Helper to append conditions to a matrix condition array
Namespace types: matrix
Parameters:
conditions (matrix)
conditionPair (array) : array A condition pair , an input can be passed directly to enable
method check(conditions, operatorAnd)
check several condition within given operator
Namespace types: matrix
Parameters:
conditions (matrix)
operatorAnd (bool) : bool true if the operator between condition is AND (default OR)
Returns: bool Evaluates conditions
isWeekend()
isNightSignal(nightHour, morningHour, timezone)
Parameters:
nightHour (int)
morningHour (int)
timezone (string)
Moving point of controlLibrary "moving_poc"
method getMovingPoc(averagePriceByVolumeHistory, ltfVolumeSerie, ltfPriceSerie, nbBarsToLookback)
Volume point of control (PoC) extracted from lower time frame data and previous time period
Namespace types: array
Parameters:
averagePriceByVolumeHistory (array) : An array of float to record previous PoC average
ltfVolumeSerie (array) : Source of volume for the lower timeframe (ltf)
ltfPriceSerie (array) : Source of price for the lower timeframe
nbBarsToLookback (int) : A number of bars determining the lookback period of this PoC
Returns: Serie of PoC
FunctionDiscreteCosineTransformLibrary "FunctionDiscreteCosineTransform"
Discrete Cosine Transform (DCT)
The Discrete Cosine Transform (DCT) is a mathematical algorithm that converts a series of samples of a signal, typically in the time domain, into another domain called the frequency or spectral domain. It's commonly used for data compression and image/video coding applications such as JPEG and MPEG standards.
The DCT works by multiplying the input sequence with specific cosine functions that are pre-defined and then summing up these products to obtain a new series of values, which represent the frequency components of the original signal. The main advantage of the DCT over other transforms like Fourier Transform is its ability to handle non-stationary signals (i.e., signals with varying statistical properties) more effectively due to its localized basis functions.
In simple terms, the DCT can be thought of as a way to break down an image or video into different frequency components and then compress them without losing too much information. This compression technique is essential for efficient transmission and storage of digital media files over the internet or on devices with limited memory capacity.
~Mixtral4x7b
___
Reference:
lcamtuf.substack.com
dct(data, len)
Discrete Cosine Transform.
Parameters:
data (array) : Data source.
len (int) : Length of the sampling window.
Returns: List with frequency domain transformed information.
dct(data, len)
Discrete Cosine Transform.
Parameters:
data (float) : Data source.
len (int) : Length of the sampling window.
Returns: List with frequency domain transformed information.
idct(data, len)
Inverse Discrete Cosine Transform.
Parameters:
data (array) : Data source.
len (int) : Length of the sampling window.
Returns: List with time domain transformed information.
idct(data, len)
Inverse Discrete Cosine Transform.
Parameters:
data (float) : Data source.
len (int) : Length of the sampling window.
Returns: List with time domain transformed information.
MyLibrary_functions_D_S_3D_D_T_PART_2Library "MyLibrary_functions_D_S_3D_D_T_PART_2"
TODO: add library description here
N_Re_Fib(Source_low, Source_high, lw, hg, x3_P, x1_P, x2_P)
Parameters:
Source_low (float)
Source_high (float)
lw (int)
hg (int)
x3_P (int)
x1_P (int)
x2_P (int)
P_lb_Re_Fib(Source_low, Source_high, lw, hg, x3_P, x1_P)
Parameters:
Source_low (float)
Source_high (float)
lw (int)
hg (int)
x3_P (int)
x1_P (int)
label_New(lw_hg, zigzag_Indicator_1_, zigzag_Indicator_2_, zigzag_Indicator_3_, Number_Of_Labels_Printed_MS_MN, x1_, i_, label_id_, style_lable_, color_lable_, size_txt_lable_, color_txt_lable_)
Parameters:
lw_hg (string)
zigzag_Indicator_1_ (bool)
zigzag_Indicator_2_ (bool)
zigzag_Indicator_3_ (bool)
Number_Of_Labels_Printed_MS_MN (int)
x1_ (int)
i_ (int)
label_id_ (string)
style_lable_ (string)
color_lable_ (color)
size_txt_lable_ (string)
color_txt_lable_ (color)
Num_last_lebel_for_scan_no(Number_Of_Labels_Printed_, array_ad, array_id, gap, scan_no)
Parameters:
Number_Of_Labels_Printed_ (int)
array_ad (array)
array_id (array)
gap (int)
scan_no (string)
Previous_piote(lw_hg, arr_x_P_lw, arr_x_P_hg, Num_last_lebel_for_scan_no_MSMN)
Parameters:
lw_hg (string)
arr_x_P_lw (array)
arr_x_P_hg (array)
Num_last_lebel_for_scan_no_MSMN (int)
Required_drawing_information(lw__, hg__, last_l__, last_h__, Source_Zigzag_low_, Source_Zigzag_high_, upcolor_li__, dncolor_li__, upcolor_txt__, dncolor_txt__)
Parameters:
lw__ (int)
hg__ (int)
last_l__ (int)
last_h__ (int)
Source_Zigzag_low_ (float)
Source_Zigzag_high_ (float)
upcolor_li__ (color)
dncolor_li__ (color)
upcolor_txt__ (color)
dncolor_txt__ (color)
draw_line_(zigzag_Indicator_, i__lw, i__hg, Scan_No, lw_, hg_, last_l_, last_h_, arr_ad_lw_, arr_ad_hg_, arr_id_lw_, arr_id_hg_, arr_x_P_lw_, arr_x_P_hg_, Num_last_lebel_for_scan_no_123_MS_, Num_last_lebel_for_scan_no_123_MN_, Source_Zigzag_low_, Source_Zigzag_high_, MS_Div_, MN_Div_, Fibonacci_Retracement_, x_P_lb_Re_Fib_, y_P_lb_Re_Fib_, N_Re_Fib_, size_txt_lable, Fibonacci_txt, line_thick_, sty_line_, upcolor_li_, dncolor_li_, upcolor_txt_, dncolor_txt_)
Parameters:
zigzag_Indicator_ (bool)
i__lw (int)
i__hg (int)
Scan_No (int)
lw_ (int)
hg_ (int)
last_l_ (int)
last_h_ (int)
arr_ad_lw_ (array)
arr_ad_hg_ (array)
arr_id_lw_ (array)
arr_id_hg_ (array)
arr_x_P_lw_ (array)
arr_x_P_hg_ (array)
Num_last_lebel_for_scan_no_123_MS_ (int)
Num_last_lebel_for_scan_no_123_MN_ (int)
Source_Zigzag_low_ (float)
Source_Zigzag_high_ (float)
MS_Div_ (bool)
MN_Div_ (bool)
Fibonacci_Retracement_ (bool)
x_P_lb_Re_Fib_ (int)
y_P_lb_Re_Fib_ (float)
N_Re_Fib_ (string)
size_txt_lable (string)
Fibonacci_txt (string)
line_thick_ (int)
sty_line_ (string)
upcolor_li_ (color)
dncolor_li_ (color)
upcolor_txt_ (color)
dncolor_txt_ (color)
draw_line_123(zigzag_Indicator_, scan_no_, lw_, hg_, last_l_, last_h_, lw_D_POINT_ad_, hg_D_POINT_ad_, lw_D_POINT_id_, hg_D_POINT_id_, x_P_123_lw_, x_P_123_hg_, lw_D_P_1__, lw_D_P_2__, lw_D_P_3__, lw_D_P_4__, lw_D_P_5__, hg_D_P_1__, hg_D_P_2__, hg_D_P_3__, hg_D_P_4__, hg_D_P_5__, Num_last_lebel_for_scan_no_123_MS_, Num_last_lebel_for_scan_no_123_MN_, Source_Zigzag_123_F_low_, Source_Zigzag_123_F_high_, MS_Div_123_, MN_Div_123_, Fibonacci_Retracement_123_, x_P_lb_Re_Fib_123_, y_P_lb_Re_Fib_123_, N_Re_Fib_123_, size_txt_lable_lb_, Fibonacci_Re_text_, line_thick_123_, sty_line_123_, upcolor_li_123_, dncolor_li_123_, upcolor_txt_123_, dncolor_txt_123_)
Parameters:
zigzag_Indicator_ (bool)
scan_no_ (int)
lw_ (int)
hg_ (int)
last_l_ (int)
last_h_ (int)
lw_D_POINT_ad_ (array)
hg_D_POINT_ad_ (array)
lw_D_POINT_id_ (array)
hg_D_POINT_id_ (array)
x_P_123_lw_ (array)
x_P_123_hg_ (array)
lw_D_P_1__ (int)
lw_D_P_2__ (int)
lw_D_P_3__ (int)
lw_D_P_4__ (int)
lw_D_P_5__ (int)
hg_D_P_1__ (int)
hg_D_P_2__ (int)
hg_D_P_3__ (int)
hg_D_P_4__ (int)
hg_D_P_5__ (int)
Num_last_lebel_for_scan_no_123_MS_ (int)
Num_last_lebel_for_scan_no_123_MN_ (int)
Source_Zigzag_123_F_low_ (float)
Source_Zigzag_123_F_high_ (float)
MS_Div_123_ (bool)
MN_Div_123_ (bool)
Fibonacci_Retracement_123_ (bool)
x_P_lb_Re_Fib_123_ (int)
y_P_lb_Re_Fib_123_ (float)
N_Re_Fib_123_ (string)
size_txt_lable_lb_ (string)
Fibonacci_Re_text_ (string)
line_thick_123_ (int)
sty_line_123_ (string)
upcolor_li_123_ (color)
dncolor_li_123_ (color)
upcolor_txt_123_ (color)
dncolor_txt_123_ (color)
draw_point_123(zigzag_Indicator_123, points_, lw, hg, last_l, last_h, Source_Zigzag_F_low, Source_Zigzag_F_high, arr_x_P_lw_, arr_x_P_hg_, Num_last_lebel_for_scan_no_123_MS_, Num_last_lebel_for_scan_no_123_MN_, size_points, style_label_upper, style_label_lower, upcolor_lebel, dncolor_lebel)
Parameters:
zigzag_Indicator_123 (bool)
points_ (bool)
lw (int)
hg (int)
last_l (int)
last_h (int)
Source_Zigzag_F_low (float)
Source_Zigzag_F_high (float)
arr_x_P_lw_ (array)
arr_x_P_hg_ (array)
Num_last_lebel_for_scan_no_123_MS_ (int)
Num_last_lebel_for_scan_no_123_MN_ (int)
size_points (string)
style_label_upper (string)
style_label_lower (string)
upcolor_lebel (color)
dncolor_lebel (color)
MyLibrary_functions_D_S_3D_D_T_PART_1Library "MyLibrary_functions_D_S_3D_D_T_PART_1"
TODO: add library description here
color_(upcolor_txt, upcolor, dncolor_txt, dncolor, theme)
Parameters:
upcolor_txt (color)
upcolor (color)
dncolor_txt (color)
dncolor (color)
theme (string)
Source_Zigzag_F(Source)
Parameters:
Source (string)
p_lw_hg(Source_low, Source_high, Depth)
Parameters:
Source_low (float)
Source_high (float)
Depth (int)
lowing_highing(Source_low, Source_high, p_lw, p_hg, Deviation)
Parameters:
Source_low (float)
Source_high (float)
p_lw (int)
p_hg (int)
Deviation (int)
ll_lh(lowing, highing)
Parameters:
lowing (bool)
highing (bool)
down_ll_down_lh(ll, lh, Backstep)
Parameters:
ll (int)
lh (int)
Backstep (int)
down(down_ll, down_lh, lw, hg)
Parameters:
down_ll (bool)
down_lh (bool)
lw (int)
hg (int)
f_x_P_S123_lw(lw_, hg_, p_lw_, down, Source_low)
Parameters:
lw_ (int)
hg_ (int)
p_lw_ (int)
down (int)
Source_low (float)
f_x_P_S123_hg(lw_, hg_, p_hg_, down, Source_high)
Parameters:
lw_ (int)
hg_ (int)
p_hg_ (int)
down (int)
Source_high (float)
Update_lw_hg_last_l_last_h(lw, hg, last_l, last_h, p_lw, p_hg, down, Source_low, Source_high)
Parameters:
lw (int)
hg (int)
last_l (int)
last_h (int)
p_lw (int)
p_hg (int)
down (int)
Source_low (float)
Source_high (float)
x1_P_y1_P_x2_P_y2_P_x3_P_y3_P_x4_P_y4_P(lw, hg, last_l, last_h, Source)
Parameters:
lw (int)
hg (int)
last_l (int)
last_h (int)
Source (string)
x1_P_os(lw, hg, x2_D, Diverjence_MACD_Line_, Diverjence_MACD_Histagram_, Diverjence_RSI_, Diverjence_Stochastic_, Diverjence_volume_, Diverjence_CCI_, Diverjence_MFI_, Diverjence_Momentum_, Diverjence_OBV_, Diverjence_ADX_, MACD, hist_MACD, RSI, volume_ok, Stochastic_K, CCI, MFI, momentum, OBV, adx)
Parameters:
lw (int)
hg (int)
x2_D (int)
Diverjence_MACD_Line_ (bool)
Diverjence_MACD_Histagram_ (bool)
Diverjence_RSI_ (bool)
Diverjence_Stochastic_ (bool)
Diverjence_volume_ (bool)
Diverjence_CCI_ (bool)
Diverjence_MFI_ (bool)
Diverjence_Momentum_ (bool)
Diverjence_OBV_ (bool)
Diverjence_ADX_ (bool)
MACD (float)
hist_MACD (float)
RSI (float)
volume_ok (float)
Stochastic_K (float)
CCI (float)
MFI (float)
momentum (float)
OBV (float)
adx (float)
x3_P_os(lw, hg, x2_D, x4_D, Diverjence_MACD_Line_, Diverjence_MACD_Histagram_, Diverjence_RSI_, Diverjence_Stochastic_, Diverjence_volume_, Diverjence_CCI_, Diverjence_MFI_, Diverjence_Momentum_, Diverjence_OBV_, Diverjence_ADX_, MACD, hist_MACD, RSI, volume_ok, Stochastic_K, CCI, MFI, momentum, OBV, adx)
Parameters:
lw (int)
hg (int)
x2_D (int)
x4_D (int)
Diverjence_MACD_Line_ (bool)
Diverjence_MACD_Histagram_ (bool)
Diverjence_RSI_ (bool)
Diverjence_Stochastic_ (bool)
Diverjence_volume_ (bool)
Diverjence_CCI_ (bool)
Diverjence_MFI_ (bool)
Diverjence_Momentum_ (bool)
Diverjence_OBV_ (bool)
Diverjence_ADX_ (bool)
MACD (float)
hist_MACD (float)
RSI (float)
volume_ok (float)
Stochastic_K (float)
CCI (float)
MFI (float)
momentum (float)
OBV (float)
adx (float)
Err_test(lw, hg, x1, y1, x2, y2, y_d, start, finish, Err_Rate)
Parameters:
lw (int)
hg (int)
x1 (int)
y1 (float)
x2 (int)
y2 (float)
y_d (float)
start (int)
finish (int)
Err_Rate (float)
divergence_calculation(Feasibility_RD, Feasibility_HD, Feasibility_ED, lw, hg, Source_low, Source_high, x1_P_pr, x3_P_pr, x1_P_os, x3_P_os, x2_P_pr, x4_P_pr, oscillator, Fix_Err_Mid_Point_Pr, Fix_Err_Mid_Point_Os, Err_Rate_permissible_Mid_Line_Pr, Err_Rate_permissible_Mid_Line_Os, Number_of_price_periods_R_H, Permissible_deviation_factor_in_Pr_R_H, Number_of_oscillator_periods_R_H, Permissible_deviation_factor_in_OS_R_H, Number_of_price_periods_E, Permissible_deviation_factor_in_Pr_E, Number_of_oscillator_periods_E, Permissible_deviation_factor_in_OS_E)
Parameters:
Feasibility_RD (bool)
Feasibility_HD (bool)
Feasibility_ED (bool)
lw (int)
hg (int)
Source_low (float)
Source_high (float)
x1_P_pr (int)
x3_P_pr (int)
x1_P_os (int)
x3_P_os (int)
x2_P_pr (int)
x4_P_pr (int)
oscillator (float)
Fix_Err_Mid_Point_Pr (bool)
Fix_Err_Mid_Point_Os (bool)
Err_Rate_permissible_Mid_Line_Pr (float)
Err_Rate_permissible_Mid_Line_Os (float)
Number_of_price_periods_R_H (int)
Permissible_deviation_factor_in_Pr_R_H (float)
Number_of_oscillator_periods_R_H (int)
Permissible_deviation_factor_in_OS_R_H (float)
Number_of_price_periods_E (int)
Permissible_deviation_factor_in_Pr_E (float)
Number_of_oscillator_periods_E (int)
Permissible_deviation_factor_in_OS_E (float)
label_txt(label_ID, zigzag_Indicator_1_, zigzag_Indicator_2_, zigzag_Indicator_3_)
Parameters:
label_ID (string)
zigzag_Indicator_1_ (bool)
zigzag_Indicator_2_ (bool)
zigzag_Indicator_3_ (bool)
delet_scan_item_1(string_, NO_1, GAP)
Parameters:
string_ (string)
NO_1 (int)
GAP (int)
delet_scan_item_2(string_, NO_1, GAP)
Parameters:
string_ (string)
NO_1 (int)
GAP (int)
calculation_Final_total(MS_MN, Scan_zigzag_NO, zigzag_Indicator, zigzag_Indicator_1, zigzag_Indicator_2, zigzag_Indicator_3, LW_hg_P2, LW_hg_P1, lw_1, lw_2, lw_3, hg_1, hg_2, hg_3, lw_hg_D_POINT_ad_Array, lw_hg_D_POINT_id_Array, Array_Regular_MS, Array_Hidden_MS, Array_Exaggerated_MS, Array_Regular_MN, Array_Hidden_MN, Array_Exaggerated_MN)
Parameters:
MS_MN (string)
Scan_zigzag_NO (string)
zigzag_Indicator (bool)
zigzag_Indicator_1 (bool)
zigzag_Indicator_2 (bool)
zigzag_Indicator_3 (bool)
LW_hg_P2 (int)
LW_hg_P1 (int)
lw_1 (int)
lw_2 (int)
lw_3 (int)
hg_1 (int)
hg_2 (int)
hg_3 (int)
lw_hg_D_POINT_ad_Array (array)
lw_hg_D_POINT_id_Array (array)
Array_Regular_MS (array)
Array_Hidden_MS (array)
Array_Exaggerated_MS (array)
Array_Regular_MN (array)
Array_Hidden_MN (array)
Array_Exaggerated_MN (array)
Search_piote_1(array_id_7, scan_no)
Parameters:
array_id_7 (array)
scan_no (int)
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.
footprint_typeLibrary "footprint_type"
Contains all types for calculating and rendering footprints
Inputs
Inputs objects
Fields:
inbalance_percent (series int) : percentage coefficient to determine the Imbalance of price levels
stacked_input (series int) : minimum number of consecutive Imbalance levels required to draw extended lines
show_summary_footprint (series bool) : bool input for show summary footprint
procent_volume_area (series int) : definition size Value area
show_vah (series bool) : bool input for show VAH
show_poc (series bool) : bool input for show POC
show_val (series bool) : bool input for show VAL
color_vah (series color) : color VAH line
color_poc (series color) : color POC line
color_val (series color) : color VAL line
show_volume_profile (series bool)
new_imbalance_cond (series bool) : bool input for setup alert on new imbalance buy and sell
new_imbalance_line_cond (series bool) : bool input for setup alert on new imbalance line buy and sell
stop_past_imbalance_line_cond (series bool) : bool input for setup alert on stop past imbalance line buy and sell
Constants
Constants all Constants objects
Fields:
imbalance_high_char (series string) : char for printing buy imbalance
imbalance_low_char (series string) : char for printing sell imbalance
color_title_sell (series color) : color for footprint sell
color_title_buy (series color) : color for footprint buy
color_line_sell (series color) : color for sell line
color_line_buy (series color) : color for buy line
color_title_none (series color) : color None
Calculation_data
Calculation_data data for calculating
Fields:
detail_open (array) : array open from calculation timeframe
detail_high (array) : array high from calculation timeframe
detail_low (array) : array low from calculation timeframe
detail_close (array) : array close from calculation timeframe
detail_vol (array) : array volume from calculation timeframe
previos_detail_close (array) : array close from calculation timeframe
isBuyVolume (series bool) : attribute previosly bar buy or sell
Footprint_row
Footprint_row objects one footprint row
Fields:
price (series float) : row price
buy_vol (series float) : buy volume
sell_vol (series float) : sell volume
imbalance_buy (series bool) : attribute buy inbalance
imbalance_sell (series bool) : attribute sell imbalance
buy_vol_box (series box) : for ptinting buy volume
sell_vol_box (series box) : for printing sell volume
buy_vp_box (series box) : for ptinting volume profile buy
sell_vp_box (series box) : for ptinting volume profile sell
row_line (series label) : for ptinting row price
empty (series bool) : = true attribute row with zero volume buy and zero volume sell
Value_area
Value_area objects for calculating and printing Value area
Fields:
vah_price (series float) : VAH price
poc_price (series float) : POC price
val_price (series float) : VAL price
vah_label (series label) : label for VAH
poc_label (series label) : label for POC
val_label (series label) : label for VAL
vah_line (series line) : line for VAH
poc_level (series line) : line for POC
val_line (series line) : line for VAL
Imbalance_line_var_object
Imbalance_line_var_object var objects printing and calculation imbalance line
Fields:
cum_buy_line (array) : line array for saving all history buy imbalance line
cum_sell_line (array) : line array for saving all history sell imbalance line
Imbalance_line
Imbalance_line objects printing and calculation imbalance line
Fields:
buy_price_line (array) : float array for saving buy imbalance price level
sell_price_line (array) : float array for saving sell imbalance price level
var_imba_line (Imbalance_line_var_object) : var objects this type
Footprint_info_var_object
Footprint_info_var_object var objects for info printing
Fields:
cum_delta (series float) : var delta volume
cum_total (series float) : var total volume
cum_buy_vol (series float) : var buy volume
cum_sell_vol (series float) : var sell volume
cum_info (series table) : table for ptinting
Footprint_info
Footprint_info objects for info printing
Fields:
var_info (Footprint_info_var_object) : var objects this type
total (series label) : total volume
delta (series label) : delta volume
summary_label (series label) : label for ptinting
Footprint_bar
Footprint_bar all objects one bar with footprint
Fields:
foot_rows (array) : objects one row footprint
val_area (Value_area) : objects Value area
imba_line (Imbalance_line) : objects imbalance line
info (Footprint_info) : objects info - table,label and their variable
row_size (series float) : size rows
total_vol (series float) : total volume one footprint bar
foot_buy_vol (series float) : buy volume one footprint bar
foot_sell_vol (series float) : sell volume one footprint bar
foot_max_price_vol (map) : map with one value - price row with max volume buy + sell
calc_data (Calculation_data) : objects with detail data from calculation resolution
Support_objects
Support_objects support object for footprint calculation
Fields:
consts (Constants) : all consts objects
inp (Inputs) : all input objects
bar_index_show_condition (series bool) : calculation bool value for show all objects footprint
row_line_color (series color) : calculation value - color for row price
TUF_LOGICThe TUF_LOGIC library incorporates three-valued logic (also known as trilean logic) into Pine Script, enabling the representation of states beyond the binary True and False to include an 'Uncertain' state. This addition is particularly apt for financial market contexts where information may not always be black or white, accommodating scenarios of partial or ambiguous data.
Key Features:
Trilean Data Type: Defines a tri type, facilitating the representation of True (1), Uncertain (0), and False (-1) states, thus accommodating a more nuanced approach to logical evaluation.
Validation and Conversion: Includes methods like validate, to ensure trilean variables conform to expected states, and to_bool, for converting trilean to boolean values, enhancing interoperability with binary logic systems.
Core Logical Operations: Extends traditional logical operators (AND, OR, NOT, XOR, EQUALITY) to work within the trilean domain, enabling complex conditionals that reflect real-world uncertainties.
Specialized Logical Operations:
Implication Operators: Features IMP_K (Kleene's), IMP_L (Łukasiewicz's), and IMP_RM3, offering varied approaches to logical implication within the trilean framework.
Possibility, Necessity, and Contingency Operators: Implements MA ("it is possible that..."), LA ("it is necessary that..."), and IA ("it is unknown/contingent that..."), derived from Tarski-Łukasiewicz's modal logic attempts, enriching the library with modal logic capabilities.
Unanimity Functions: The UNANIMOUS operator assesses complete agreement among trilean values, useful for scenarios requiring consensus or uniformity across multiple indicators or conditions.
This library is developed to support scenarios in financial trading and analysis where decisions might hinge on more than binary outcomes. By incorporating modal logic aspects and providing a framework for handling uncertainty through the MA, LA, and IA operations, TUF_LOGIC bridges the gap between classical binary logic and the realities of uncertain information, making it a valuable tool for developing sophisticated trading strategies and analytical models.
Library "TUF_LOGIC"
3VL Implementation (TUF stands for True, Uncertain, False.)
method validate(self)
Ensures a valid trilean variable. This works by clamping the variable to the range associated with the trilean type.
Namespace types: tri
Parameters:
self (tri)
Returns: Validated trilean object.
method to_bool(self)
Converts a trilean object into a boolean object. True -> True, Uncertain -> na, False -> False.
Namespace types: tri
Parameters:
self (tri)
Returns: A boolean variable.
method NOT(self)
Negates the trilean object. True -> False, Uncertain -> Uncertain, False -> True
Namespace types: tri
Parameters:
self (tri)
Returns: Negated trilean object.
method AND(self, comparator)
Logical AND operation for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The first trilean object.
comparator (tri) : The second trilean object to compare with.
Returns: `tri` Result of the AND operation as a trilean object.
method OR(self, comparator)
Logical OR operation for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The first trilean object.
comparator (tri) : The second trilean object to compare with.
Returns: `tri` Result of the OR operation as a trilean object.
method EQUALITY(self, comparator)
Logical EQUALITY operation for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The first trilean object.
comparator (tri) : The second trilean object to compare with.
Returns: `tri` Result of the EQUALITY operation as a trilean object, True if both are equal, False otherwise.
method XOR(self, comparator)
Logical XOR (Exclusive OR) operation for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The first trilean object.
comparator (tri) : The second trilean object to compare with.
Returns: `tri` Result of the XOR operation as a trilean object.
method IMP_K(self, comparator)
Material implication using Kleene's logic for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The antecedent trilean object.
comparator (tri) : The consequent trilean object.
Returns: `tri` Result of the implication operation as a trilean object.
method IMP_L(self, comparator)
Logical implication using Łukasiewicz's logic for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The antecedent trilean object.
comparator (tri) : The consequent trilean object.
Returns: `tri` Result of the implication operation as a trilean object.
method IMP_RM3(self, comparator)
Logical implication using RM3 logic for trilean objects.
Namespace types: tri
Parameters:
self (tri) : The antecedent trilean object.
comparator (tri) : The consequent trilean object.
Returns: `tri` Result of the RM3 implication as a trilean object.
method MA(self)
Evaluates to True if the trilean object is either True or Uncertain, False otherwise.
Namespace types: tri
Parameters:
self (tri) : The trilean object to evaluate.
Returns: `tri` Result of the operation as a trilean object.
method LA(self)
Evaluates to True if the trilean object is True, False otherwise.
Namespace types: tri
Parameters:
self (tri) : The trilean object to evaluate.
Returns: `tri` Result of the operation as a trilean object.
method IA(self)
Evaluates to True if the trilean object is Uncertain, False otherwise.
Namespace types: tri
Parameters:
self (tri) : The trilean object to evaluate.
Returns: `tri` Result of the operation as a trilean object.
UNANIMOUS(self, comparator)
Evaluates the unanimity between two trilean values.
Parameters:
self (tri) : The first trilean value.
comparator (tri) : The second trilean value.
Returns: `tri` Returns True if both values are True, False if both are False, and Uncertain otherwise.
method UNANIMOUS(self)
Evaluates the unanimity among an array of trilean values.
Namespace types: array
Parameters:
self (array) : The array of trilean values.
Returns: `tri` Returns True if all values are True, False if all are False, and Uncertain otherwise.
tri
Three Value Logic (T.U.F.), or trilean. Can be True (1), Uncertain (0), or False (-1).
Fields:
v (series int) : Value of the trilean variable. Can be True (1), Uncertain (0), or False (-1).
LogLibrary "Log"
- Log methods that return input value for code readbility and cleaness.
method str(input)
str
Namespace types: series float, simple float, input float, const float
Parameters:
input (float)
method str(input)
str
Namespace types: series int, simple int, input int, const int
Parameters:
input (int)
method str(input)
str
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
input (bool)
method str(input)
str
Namespace types: series string, simple string, input string, const string
Parameters:
input (string)
method str(input)
str
Namespace types: series linefill
Parameters:
input (linefill)
method str(input)
str
Namespace types: series line
Parameters:
input (line)
method str(input)
str
Namespace types: series box
Parameters:
input (box)
method str(input)
str
Namespace types: series label
Parameters:
input (label)
method str(input)
str
Namespace types: chart.point
Parameters:
input (chart.point)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: array
Parameters:
input (array)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
str
Namespace types: matrix
Parameters:
input (matrix)
method str(input)
Namespace types: matrix
Parameters:
input (matrix)
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: chart.point
Parameters:
input (chart.point) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series float, simple float, input float, const float
Parameters:
input (float) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series int, simple int, input int, const int
Parameters:
input (int) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
input (bool) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series string, simple string, input string, const string
Parameters:
input (string) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series linefill
Parameters:
input (linefill) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series line
Parameters:
input (line) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input value with the 'info' log level.
Namespace types: series box
Parameters:
input (box) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: series label
Parameters:
input (label) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input array with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: array
Parameters:
input (array) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Logs the input matrix with the 'info' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method info(input, msg)
Namespace types: matrix
Parameters:
input (matrix)
msg (string)
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: chart.point
Parameters:
input (chart.point) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series float, simple float, input float, const float
Parameters:
input (float) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series int, simple int, input int, const int
Parameters:
input (int) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
input (bool) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series string, simple string, input string, const string
Parameters:
input (string) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series linefill
Parameters:
input (linefill) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series line
Parameters:
input (line) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input value with the 'warning' log level.
Namespace types: series box
Parameters:
input (box) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: series label
Parameters:
input (label) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input array with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: array
Parameters:
input (array) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Logs the input matrix with the 'warning' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method warn(input, msg)
Namespace types: matrix
Parameters:
input (matrix)
msg (string)
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: chart.point
Parameters:
input (chart.point) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series float, simple float, input float, const float
Parameters:
input (float) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series int, simple int, input int, const int
Parameters:
input (int) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
input (bool) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series string, simple string, input string, const string
Parameters:
input (string) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series linefill
Parameters:
input (linefill) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series line
Parameters:
input (line) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input value with the 'error' log level.
Namespace types: series box
Parameters:
input (box) : The input value to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input value.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: series label
Parameters:
input (label) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input array with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input array.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: array
Parameters:
input (array) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Logs the input matrix with the 'error' log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
Returns: The input matrix.
method error(input, msg)
Namespace types: matrix
Parameters:
input (matrix)
msg (string)
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: chart.point
Parameters:
input (chart.point) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series float, simple float, input float, const float
Parameters:
input (float) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series int, simple int, input int, const int
Parameters:
input (int) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
input (bool) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series string, simple string, input string, const string
Parameters:
input (string) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series linefill
Parameters:
input (linefill) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series line
Parameters:
input (line) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input value with the specified log level.
Namespace types: series box
Parameters:
input (box) : The input value to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input value.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: series label
Parameters:
input (label) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input array with the specified log level.
Namespace types: array
Parameters:
input (array) : The input array to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input array.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: array
Parameters:
input (array) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Logs the input matrix with the specified log level.
Namespace types: matrix
Parameters:
input (matrix) : The input matrix to log.
msg (string) : The message to log. Default is an empty string.
level (int) : The log level (1 - info, 2 - warning, 3 - error). Default is 1.
Returns: The input matrix.
method log(input, msg, level)
Namespace types: matrix
Parameters:
input (matrix)
msg (string)
level (int)
DynamicFunctionsLibrary "DynamicFunctions"
Custom Dynamic functions that allow an adaptive calculation beginning from the first bar
RoC(src, period)
Dynamic RoC
Parameters:
src (float) : and period
Custom function to calculate the actual period considering non-na source values
period (int)
dynamicMedian(src, length)
Dynamic Median
Parameters:
src (float) : and length
length (int)
kernelRegression(src, bandwidth, kernel_type)
Dynamic Kernel Regression Calculation Uses either of the following inputs for kernel_type: Epanechnikov Logistic Wave
Parameters:
src (float)
bandwidth (int)
kernel_type (string)
waveCalculation(source, bandwidth, width)
Use together with kernelRegression function to get chart applicable band
Parameters:
source (float)
bandwidth (int)
width (float)
Rsi(src, length)
Dynamic RSI function
Parameters:
src (float)
length (int)
dynamicStdev(src, period)
Dynamic SD function
Parameters:
src (float)
period (int)
stdv_bands(src, length, mult)
Dynamic SD Bands
Parameters:
src (float)
length (int)
mult (float)
Returns: Basis, Positive SD, Negative SD
Adx(dilen, adxlen)
Dynamic ADX
Parameters:
dilen (int)
adxlen (int)
Returns: adx
Atr(length)
Dynamic ATR
Parameters:
length (int)
Returns: ATR
Macd(source, fastLength, slowLength, signalSmoothing)
Dynamic MACD
Parameters:
source (float)
fastLength (int)
slowLength (int)
signalSmoothing (int)
Returns: macdLine, signalLine, histogram
ZigZag Library [TradingFinder]🔵 Introduction
The "Zig Zag" indicator is an analytical tool that emerges from pricing changes. Essentially, it connects consecutive high and low points in an oscillatory manner. This method helps decipher price changes and can also be useful in identifying traditional patterns.
By sifting through partial price changes, "Zig Zag" can effectively pinpoint price fluctuations within defined time intervals.
🔵 Key Features
1. Drawing the Zig Zag based on Pivot points :
The algorithm is based on pivots that operate consecutively and alternately (switch between high and low swing). In this way, zigzag lines are connected from a swing high to a swing low and from a swing low to a swing high.
Also, with a very low probability, it is possible to have both low pivots and high pivots in one candle. In these cases, the algorithm tries to make the best decision to make the most suitable choice.
You can control what period these decisions are based on through the "PiPe" parameter.
2.Naming and labeling each pivot based on its position as "Higher High" (HH), "Lower Low" (LL), "Higher Low" (HL), and "Lower High" (LH).
Additionally, classic patterns such as HH, LH, LL, and HL can be recognized. All traders analyzing financial markets using classic patterns and Elliot Waves can benefit from the "zigzag" indicator to facilitate their analysis.
" HH ": When the price is higher than the previous peak (Higher High).
" HL ": When the price is higher than the previous low (Higher Low).
" LH ": When the price is lower than the previous peak (Lower High).
" LL ": When the price is lower than the previous low (Lower Low).
🔵 How to Use
First, you can add the library to your code as shown in the example below.
import TFlab/ZigZagLibrary_TradingFinder/1 as ZZ
Function "ZigZag" Parameters :
🟣 Logical Parameters
1. HIGH : You should place the "high" value here. High is a float variable.
2. LOW : You should place the "low" value here. Low is a float variable.
3. BAR_INDEX : You should place the "bar_index" value here. Bar_index is an integer variable.
4. PiPe : The desired pivot period for plotting Zig Zag is placed in this parameter. For example, if you intend to draw a Zig Zag with a Swing Period of 5, you should input 5.
PiPe is an integer variable.
Important :
Apart from the "PiPe" indicator, which is part of the customization capabilities of this indicator, you can create a multi-time frame mode for the indicator using 3 parameters "High", "Low" and "BAR_INDEX". In this way, instead of the data of the current time frame, use the data of other time frames.
Note that it is better to use the current time frame data, because using the multi-time frame mode is associated with challenges that may cause bugs in your code.
🟣 Setting Parameters
5. SHOW_LINE : It's a boolean variable. When true, the Zig Zag line is displayed, and when false, the Zig Zag line display is disabled.
6. STYLE_LINE : In this variable, you can determine the style of the Zig Zag line. You can input one of the 3 options: line.style_solid, line.style_dotted, line.style_dashed. STYLE_LINE is a constant string variable.
7. COLOR_LINE : This variable takes the input of the line color.
8. WIDTH_LINE : The input for this variable is a number from 1 to 3, which is used to adjust the thickness of the line that draws the Zig Zag. WIDTH_LINE is an integer variable.
9. SHOW_LABEL : It's a boolean variable. When true, labels are displayed, and when false, label display is disabled.
10. COLOR_LABEL : The color of the labels is set in this variable.
11. SIZE_LABEL : The size of the labels is set in this variable. You should input one of the following options: size.auto, size.tiny, size.small, size.normal, size.large, size.huge.
12. Show_Support : It's a boolean variable that, when true, plots the last support line, and when false, disables its plotting.
13. Show_Resistance : It's a boolean variable that, when true, plots the last resistance line, and when false, disables its plotting.
Suggestion :
You can use the following code snippet to import Zig Zag into your code for time efficiency.
//import Library
import TFlab/ZigZagLibrary_TradingFinder/1 as ZZ
// Input and Setting
// Zig Zag Line
ShZ = input.bool(true , 'Show Zig Zag Line', group = 'Zig Zag') //Show Zig Zag
PPZ = input.int(5 ,'Pivot Period Zig Zag Line' , group = 'Zig Zag') //Pivot Period Zig Zag
ZLS = input.string(line.style_dashed , 'Zig Zag Line Style' , options = , group = 'Zig Zag' )
//Zig Zag Line Style
ZLC = input.color(color.rgb(0, 0, 0) , 'Zig Zag Line Color' , group = 'Zig Zag') //Zig Zag Line Color
ZLW = input.int(1 , 'Zig Zag Line Width' , group = 'Zig Zag')//Zig Zag Line Width
// Label
ShL = input.bool(true , 'Label', group = 'Label') //Show Label
LC = input.color(color.rgb(0, 0, 0) , 'Label Color' , group = 'Label')//Label Color
LS = input.string(size.tiny , 'Label size' , options = , group = 'Label' )//Label size
Show_Support= input.bool(false, 'Show Last Support',
tooltip = 'Last Support' , group = 'Support and Resistance')
Show_Resistance = input.bool(false, 'Show Last Resistance',
tooltip = 'Last Resistance' , group = 'Support and Resistance')
//Call Function
ZZ.ZigZag(high ,low ,bar_index ,PPZ , ShZ ,ZLS , ZLC, ZLW ,ShL , LC , LS , Show_Support , Show_Resistance )
footprint_logicLibrary "footprint_logic"
Footprint logic getting internal buy/sell volume, inbalance...
get_buy_sell_volume(previos_close, tick_close, tick_high, tick_low, row_size, global_inbalance_high, global_inbalance_low, global_line_inbalance_high, global_line_inbalance_low, footprint_price, footprint_volume, tick_close_prev, level_group, tick_vol, stacked_input, inbalance_percent)
get global_buy_vol,global_sell_vol,level_volume_buy,level_volume_sell,level_inbalance_buy,level_inbalance_sell
Parameters:
previos_close (string)
tick_close (array)
tick_high (array)
tick_low (array)
row_size (float)
global_inbalance_high (array)
global_inbalance_low (array)
global_line_inbalance_high (array)
global_line_inbalance_low (array)
footprint_price (array)
footprint_volume (array)
tick_close_prev (array)
level_group (array)
tick_vol (array)
stacked_input (int)
inbalance_percent (int)
Returns: : float global_buy_vol,float global_sell_vol, level_volume_buy, level_volume_sell,map.new level_inbalance_buy,map.new level_inbalance_sell
Kernels©2024, GoemonYae; copied from @jdehorty's "KernelFunctions" on 2024-03-09 to ensure future dependency compatibility. Will also add more functions to this script.
Library "KernelFunctions"
This library provides non-repainting kernel functions for Nadaraya-Watson estimator implementations. This allows for easy substition/comparison of different kernel functions for one another in indicators. Furthermore, kernels can easily be combined with other kernels to create newer, more customized kernels.
rationalQuadratic(_src, _lookback, _relativeWeight, startAtBar)
Rational Quadratic Kernel - An infinite sum of Gaussian Kernels of different length scales.
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
_relativeWeight (simple float) : Relative weighting of time frames. Smaller values resut in a more stretched out curve and larger values will result in a more wiggly curve. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel.
startAtBar (simple int)
Returns: yhat The estimated values according to the Rational Quadratic Kernel.
gaussian(_src, _lookback, startAtBar)
Gaussian Kernel - A weighted average of the source series. The weights are determined by the Radial Basis Function (RBF).
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
startAtBar (simple int)
Returns: yhat The estimated values according to the Gaussian Kernel.
periodic(_src, _lookback, _period, startAtBar)
Periodic Kernel - The periodic kernel (derived by David Mackay) allows one to model functions which repeat themselves exactly.
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
_period (simple int) : The distance between repititions of the function.
startAtBar (simple int)
Returns: yhat The estimated values according to the Periodic Kernel.
locallyPeriodic(_src, _lookback, _period, startAtBar)
Locally Periodic Kernel - The locally periodic kernel is a periodic function that slowly varies with time. It is the product of the Periodic Kernel and the Gaussian Kernel.
Parameters:
_src (float) : The source series.
_lookback (simple int) : The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
_period (simple int) : The distance between repititions of the function.
startAtBar (simple int)
Returns: yhat The estimated values according to the Locally Periodic Kernel.
Liquidity Finder Library🔵 Introduction
You may intend to utilize the "Liquidity" detection capability in your indicators. Instead of writing it, you can import the "Liquidity Finder" library into your code. One of the advantages of this approach is time-saving and reduction in scripting errors.
🔵 Key Features
Identification of "Statics Liquidity"
Identification of "Dynamics Liquidity"
🔵 How to Use
Firstly, you can add the library to your code as shown in the example below :
import TFlab/LiquidityFinderLibrary/1 as Liq
The parameters of the "LLF" function are as follows :
sPP : A float variable ranging from 0 to 0.4. Increasing this number decreases the sensitivity of the "Statics Liquidity Line Detection" function and increases the number of detected lines. The default value is 0.3.
dPP : A float variable ranging from 0.4 to 1.95. Increasing this number increases the sensitivity of the "Dynamics Liquidity Line Detection" function and decreases the number of detected lines. The default value is 1.
SRs : An int variable. By default, it's set to 8. You can change this number to specify the periodicity of static liquidity pivot lines.
SRd : An int variable. By default, it's set to 3. You can change this number to specify the periodicity of dynamic liquidity pivot lines.
ShowHLLs : A bool variable. You can enable or disable the display of "High Statics Liquidity Line".
ShowLLLs : A bool variable. You can enable or disable the display of "Low Statics Liquidity Line".
ShowHLLd : A bool variable. You can enable or disable the display of "High Dynamics Liquidity Line".
ShowLLd : A bool variable. You can enable or disable the display of "High Dynamics Liquidity Line".
🟣Recommendation
You can use the following code snippet to import Liquidity Finder into your code for time-saving.
//import Library
import TFlab/LiquidityFinderLibrary/1 as Liq
//input
SLLS = input.float(0.30 , 'Statics Liquidity Line Sensitivity', maxval = 0.4 ,minval = 0.0, step = 0.01) // Statics Liquidity Line Sensitivity
DLLS = input.float(1.00 , 'Dynamics Liquidity Line Sensitivity', maxval = 1.95 ,minval = 0.4, step = 0.01) // Dynamics Liquidity Line Sensitivity
SPP = input.int(8 , 'Statics Period Pivot') // Statics Period Pivot
DPP = input.int(3 , 'Dynamics Period Pivot') // Dynamics Period Pivot
ShowSHLL = input.bool(true , 'Show Statics High Liquidity Line')
ShowSLLL = input.bool(true , 'Show Statics Low Liquidity Line')
ShowDHLL = input.bool(true , 'Show Dynamics High Liquidity Line')
ShowDLLL = input.bool(true , 'Show Dynamics Low Liquidity Line')
//call function
Liq.LLF(SPP,DPP,SLLS,DLLS,ShowSHLL,ShowSLLL,ShowDHLL,ShowDLLL)