EC_2024_Q3_SPLibrary "EC_2024_Q3_SP"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
Indicators and strategies
EC_2024_Q4_ENLibrary "EC_2024_Q4_EN"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2024_Q3_ENLibrary "EC_2024_Q3_EN"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2024_Q2_ENLibrary "EC_2024_Q2_EN"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2024_Q2_SPLibrary "EC_2024_Q2_SP"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2024_Q1_SPLibrary "EC_2024_Q1_SP"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2024_Q1_ENLibrary "EC_2024_Q1_EN"
output2024()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2024()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2024()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2024()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q4_SPLibrary "EC_2023_Q4_SP"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q3_SPLibrary "EC_2023_Q3_SP"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q2_SPLibrary "EC_2023_Q2_SP"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q1_SPLibrary "EC_2023_Q1_SP"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q4_ENLibrary "EC_2023_Q4_EN"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q3_ENLibrary "EC_2023_Q3_EN"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q2_ENLibrary "EC_2023_Q2_EN"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
EC_2023_Q1_ENLibrary "EC_2023_Q1_EN"
output2023()
Returns the list of events during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;;; ...
Where: is expressed as date + characteristics: YYYY,MM,DD,hh,mm,ss,x,y,z
x impact in numbers
y event name in numbers
z currency in numbers
name2023()
Returns the list of event names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, name
index: related to event name y
name event: event name related to y text
impact2023()
Returns the list of impact names during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, impact
index: related to impact name x
impact: impact name related to x text
currency2023()
Returns the list of currencies during the period.
Returns: array: (week1,week2, ... week_n)
week_n= ;; ...
Where: is expressed as: index, currency
index: related to currency name z
currency: currency name related to z text
Sessions KillZones Library [TradingFinder]🔵 Introduction
"The Forex Trading Sessions" highlight the active periods across different markets where significant trading volume and influence on the forex market are evident. The primary trading sessions globally include the "Asian Session," "London Session," and "New York Session."
A "Kill Zone" refers to a segment within a session characterized by high trading volume and notably sharper price movements. Consequently, there's a higher probability of encountering price action setups within these zones. Traders capitalize on this phenomenon in pursuit of more successful trading outcomes.
If you aim to integrate sessions or kill zones into your indicators or strategies, utilizing this library can amplify the precision and efficiency of your Python script development.
🔵 How to Use
First, you can add the library to your code as shown in the example below:
import TFlab/SessionAndKillZoneLibrary_TradingFinder/1
🟣 Parameters
SessionDetector(Session_Name, Session_Time, KillZone_Time, Session_Show, KillZone_Show, AreaUpdate, MoreInfo, Session_Color, Info_Color) =>
Parameters:
•Session_Name (string)
•Session_Time (string)
•KillZone_Time (string)
•Session_Show (bool)
•KillZone_Show (bool)
•AreaUpdate (string)
•MoreInfo (bool)
•Session_Color (color)
•Info_Color (color)
Session_Name : You must enter the session name in this parameter.
Session_Time : Enter here the start and end time of the session, which should be based on the UTC time zone.
KillZone_Time : Enter the start and end times of the kill zone, which should be based on the UTC time zone, here.
Session_Show : You can control whether or not to show the session using this entry. You must set true to display and false to not display.
KillZone_Show : Using this input you can control whether the kill zone is displayed or not. You must set true to display and false to not display.
AreaUpdate : If you want the session to be determined based on the time and high and low of the session itself, you must enter "Session" and if you want the area to be determined based on the time and high and low of the kill zone, you must enter "Kill Zone".
MoreInfo : If you want more information, you should set this entry to true, otherwise set to false. This information includes the number of candles in the area, the length of time in the area and the volume of transactions in the area.
Session_Color : Enter your desired color to display the session at this section. It is recommended to use bright and sharp colors.
Info_Color : Enter your desired color to display more information in this section.
🔵 Function Outputs
The outputs of this function are direct and indirect.
🟣 Indirect outputs
These outputs include session display, kill zone display, and time and volume information of session or kill zone.
🟣 Direct outputs
There are 8 direct outputs, which are:
Session Time : If the Session is active, it outputs 1, and if the Session is inactive, it outputs 0.
Kill Zone Time : If the Kill Zone is active, it outputs 1, and if the Kill Zone is inactive, it outputs 0.
Open : Session opening price.
High : The highest price of the session.
Low : The lowest price of the session.
Close : The last price of the session.
Low Touch Alert : If "Area Update" is in "Kill Zone" mode, if the price reaches the lowest price of the kill zone in the same session after the end of the kill zone, this output will be true. You can use this output to create an alert.
High Touch Alert : If "Area Update" is in "Kill Zone" mode, if the price reaches the highest price of the kill zone in the same session after the end of the kill zone, this output will be true. You can use this output to create an alert.
Important : To use "Open", "High", "Low" and "Close", "Area Update" must be in "Session" mode.
Useful_lib_publicLibrary "Useful_lib_public"
Useful functions
CountBarsOfDay()
count bars for one for the diffrent time frames
Returns: number of bars for one day
LastBarsOfDay()
Index number for the las bar for one day
Returns: TRUE is that the last bar from day
isTuesday()
TRUE is tuesday
Returns: TRUE is tuesday else FALSE
Rsi(src, len)
RSI calulation
Parameters:
src (float) : RSI Source
len (simple int) : RSI Length
Returns: RSI Value
CalcIndex(netPos, weeks)
Index calulation
Parameters:
netPos (float) : Source
weeks (simple int) : Length
Returns: "COT Index"
RsiStock(src, len, smoothK)
TRUE is tuesday
Parameters:
src (float)
len (simple int)
smoothK (int)
Returns: RSI Stochastik
Offset()
Use Offset for Day time frame
Returns: Offset
PercentChange(Data, LastData)
Calc different in Percent
Parameters:
Data (float)
LastData (float)
Returns: Change in percent
MathOperatorLibrary "MathOperator"
Methods to handle operators.
method add(value_a, value_b)
Add value a to b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: float.
method subtract(value_a, value_b)
subtract value b from a.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: float.
method multiply(value_a, value_b)
multiply value a with b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: float.
method divide(value_a, value_b)
divide value a with b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: float.
method remainder(value_a, value_b)
remainder of a with b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: float.
method equal(value_a, value_b)
equality of value a with b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: bool.
method not_equal(value_a, value_b)
inequality of value a with b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: bool.
method over(value_a, value_b)
value a is over b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: bool.
method under(value_a, value_b)
value a is under b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: bool.
method over_equal(value_a, value_b)
value a is over equal b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: bool.
method under_equal(value_a, value_b)
value a is under equal b.
Namespace types: series float, simple float, input float, const float
Parameters:
value_a (float) : float, value a.
value_b (float) : float, value b.
Returns: bool.
method and_(value_a, value_b)
logical and of a with b
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
value_b (bool) : bool, value b.
Returns: bool.
method or_(value_a, value_b)
logical or of a with b.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
value_b (bool) : bool, value b.
Returns: bool.
method not_(value_a)
logical not of a.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
Returns: bool.
method xor_(value_a, value_b)
logical xor of a with b.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
value_b (bool) : bool, value b.
Returns: bool.
method xnor_(value_a, value_b)
logical xnor of a with b.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
value_b (bool) : bool, value b.
Returns: bool.
method nand_(value_a, value_b)
logical nand of a with b.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
value_b (bool) : bool, value b.
Returns: bool.
method nor_(value_a, value_b)
logical nor of a with b.
Namespace types: series bool, simple bool, input bool, const bool
Parameters:
value_a (bool) : bool, value a.
value_b (bool) : bool, value b.
Returns: bool.
strategy_helpersThis library is designed to aid traders and developers in calculating risk metrics efficiently across different asset types like equities, futures, and forex. It includes comprehensive functions that calculate the number of units or contracts to trade, the value at risk, and the total value of the position based on provided entry prices, stop levels, and risk percentages. Whether you're managing a portfolio or developing trading strategies, this library provides essential tools for risk management. Functions also automatically select the appropriate risk calculation method based on asset type, calculate leverage levels, and determine potential liquidation points for leveraged positions. Perfect for enhancing the precision and effectiveness of your trading strategies.
Library "strategy_helpers"
Provides tools for calculating risk metrics across different types of trading strategies including equities, futures, and forex. Functions allow for precise control over risk management by calculating the number of units or contracts to trade, the value at risk, and the total position value based on entry prices, stop levels, and desired risk percentage. Additional utilities include automatic risk calculation based on asset type, leverage level calculations, and determination of liquidation levels for leveraged trades.
calculate_risk(entry, stop_level, stop_range, capital, risk_percent, trade_direction, whole_number_buy)
Calculates risk metrics for equity trades based on entry, stop level, and risk percent
Parameters:
entry (float) : The price at which the position is entered. Use close if you arent adding to a position. Use the original entry price if you are adding to a position.
stop_level (float) : The price level where the stop loss is placed
stop_range (float) : The price range from entry to stop level
capital (float) : The total capital available for trading
risk_percent (float) : The percentage of capital risked on the trade. 100% is represented by 100.
trade_direction (bool) : True for long trades, false for short trades
whole_number_buy (bool) : True to adjust the quantity to whole numbers
Returns: A tuple containing the number of units to trade, the value at risk, and the total value of the position:
calculate_risk_futures(risk_capital, stop_range)
Calculates risk metrics for futures trades based on the risk capital and stop range
Parameters:
risk_capital (float) : The capital allocated for the trade
stop_range (float) : The price range from entry to stop level
Returns: A tuple containing the number of contracts to trade, the value at risk, and the total value of the position:
calculate_risk_forex(entry, stop_level, stop_range, capital, risk_percent, trade_direction)
Calculates risk metrics for forex trades based on entry, stop level, and risk percent
Parameters:
entry (float) : The price at which the position is entered. Use close if you arent adding to a position. Use the original entry price if you are adding to a position.
stop_level (float) : The price level where the stop loss is placed
stop_range (float) : The price range from entry to stop level
capital (float) : The total capital available for trading
risk_percent (float) : The percentage of capital risked on the trade. 100% is represented by 100.
trade_direction (bool) : True for long trades, false for short trades
Returns: A tuple containing the number of lots to trade, the value at risk, and the total value of the position:
calculate_risk_auto(entry, stop_level, stop_range, capital, risk_percent, trade_direction, whole_number_buy)
Automatically selects the risk calculation method based on the asset type and calculates risk metrics
Parameters:
entry (float) : The price at which the position is entered. Use close if you arent adding to a position. Use the original entry price if you are adding to a position.
stop_level (float) : The price level where the stop loss is placed
stop_range (float) : The price range from entry to stop level
capital (float) : The total capital available for trading
risk_percent (float) : The percentage of capital risked on the trade. 100% is represented by 100.
trade_direction (bool) : True for long trades, false for short trades
whole_number_buy (bool) : True to adjust the quantity to whole numbers, applicable only for non-futures and non-forex trades
Returns: A tuple containing the number of units or contracts to trade, the value at risk, and the total value of the position:
leverage_level(account_equity, position_value)
Calculates the leverage level used based on account equity and position value
Parameters:
account_equity (float) : Total equity in the trading account
position_value (float) : Total value of the position taken
Returns: The leverage level used in the trade
calculate_liquidation_level(entry, leverage, trade_direction, maintenance_margine)
Calculates the liquidation price level for a leveraged trade
Parameters:
entry (float) : The price at which the position is entered
leverage (float) : The leverage level used in the trade
trade_direction (bool) : True for long trades, false for short trades
maintenance_margine (float) : The maintenance margin requirement, expressed as a percentage
Returns: The price level at which the position would be liquidated, or na if leverage is zero
WebhookMessageDevLibrary "WebhookMessageDev"
The webhook message library provides several functions for building JSON payloads
method buildWebhookJson(msg)
Builds the final JSON payload from a webhookMessage type.
Namespace types: webhookMessage
Parameters:
msg (webhookMessage) : (webhookMessage) A prepared webhookMessage.
Returns: A JSON Payload.
method buildTakeProfitJson(msg)
Builds the takeProfit JSON message to be used in a webhook message.
Namespace types: takeProfitMessage
Parameters:
msg (takeProfitMessage) : (takeProfitMessage)
Returns: A JSON takeProfit payload.
method buildStopLossJson(msg)
Builds the stopLoss JSON message to be used in a webhook message.
Namespace types: stopLossMessage
Parameters:
msg (stopLossMessage) : (stopLossMessage)
Returns: A JSON stopLoss payload.
webhookMessage
Final webhook message.
Fields:
ticker (series string)
action (series string)
sentiment (series string)
price (series float)
quantity (series int)
takeProfit (series string)
stopLoss (series string)
takeProfitMessage
Take profit message.
Fields:
limitPrice (series float)
percent (series float)
amount (series float)
stopLossMessage
Stop loss message.
Fields:
type (series string)
percent (series float)
amount (series float)
stopPrice (series float)
limitPrice (series float)
trailPrice (series float)
trailPercent (series float)
chrono_utilsLibrary "chrono_utils"
Collection of objects and common functions that are related to datetime windows session days and time
ranges. The main purpose of this library is to handle time-related functionality and make it easy to reason about a
future bar checking if it will be part of a predefined session and/or inside a datetime window. All existing session
functionality I found in the documentation e.g. "not na(time(timeframe, session, timezone))" are not suitable for
strategy scripts, since the execution of the orders is delayed by one bar, due to the script execution happening at
the bar close. Moreover, a history operator with a negative value that looks forward is not allowed in any pinescript
expression. So, a prediction for the next bar using the bars_back argument of "time()"" and "time_close()" was
necessary. Thus, I created this library to overcome this small but very important limitation. In the meantime, I
added useful functionality to handle session-based behavior. An interesting utility that emerged from this
development is the data anomaly detection where a comparison between the prediction and the actual value is happening.
If those two values are different then a data inconsistency happened between the prediction bar and the actual bar
(probably due to a holiday, half session day, a timezone change etc..)
exTimezone(timezone)
exTimezone - Convert extended timezone to timezone string
Parameters:
timezone (simple string) : - The timezone or a special string
Returns: string representing the timezone
nameOfDay(day)
nameOfDay - Convert the day id into a short nameOfDay
Parameters:
day (int) : - The day id to convert
Returns: - The short name of the day
today()
today - Get the day id of this day
Returns: - The day id
nthDayAfter(day, n)
nthDayAfter - Get the day id of n days after the given day
Parameters:
day (int) : - The day id of the reference day
n (int) : - The number of days to go forward
Returns: - The day id of the day that is n days after the reference day
nextDayAfter(day)
nextDayAfter - Get the day id of next day after the given day
Parameters:
day (int) : - The day id of the reference day
Returns: - The day id of the next day after the reference day
nthDayBefore(day, n)
nthDayBefore - Get the day id of n days before the given day
Parameters:
day (int) : - The day id of the reference day
n (int) : - The number of days to go forward
Returns: - The day id of the day that is n days before the reference day
prevDayBefore(day)
prevDayBefore - Get the day id of previous day before the given day
Parameters:
day (int) : - The day id of the reference day
Returns: - The day id of the previous day before the reference day
tomorrow()
tomorrow - Get the day id of the next day
Returns: - The next day day id
normalize(num, min, max)
normalizeHour - Check if number is inthe range of
Parameters:
num (int)
min (int)
max (int)
Returns: - The normalized number
normalizeHour(hourInDay)
normalizeHour - Check if hour is valid and return a noralized hour range from
Parameters:
hourInDay (int)
Returns: - The normalized hour
normalizeMinute(minuteInHour)
normalizeMinute - Check if minute is valid and return a noralized minute from
Parameters:
minuteInHour (int)
Returns: - The normalized minute
monthInMilliseconds(mon)
monthInMilliseconds - Calculate the miliseconds in one bar of the timeframe
Parameters:
mon (int) : - The month of reference to get the miliseconds
Returns: - The number of milliseconds of the month
barInMilliseconds()
barInMilliseconds - Calculate the miliseconds in one bar of the timeframe
Returns: - The number of milliseconds in one bar
method to_string(this)
to_string - Formats the time window into a human-readable string
Namespace types: DateTimeWindow
Parameters:
this (DateTimeWindow) : - The time window object with the from and to datetimes
Returns: - The string of the time window
method to_string(this)
to_string - Formats the session days into a human-readable string with short day names
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object with the day selection
Returns: - The string of the session day short names
method to_string(this)
to_string - Formats the session time into a human-readable string
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
Returns: - The string of the session time
method to_string(this)
to_string - Formats the session time into a human-readable string
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
Returns: - The string of the session time
method to_string(this)
to_string - Formats the session into a human-readable string
Namespace types: Session
Parameters:
this (Session) : - The session object with the day and the time range selection
Returns: - The string of the session
method init(this, fromDateTime, toDateTime)
init - Initialize the time window object from boolean values of each session day
Namespace types: DateTimeWindow
Parameters:
this (DateTimeWindow) : - The time window object that will hold the from and to datetimes
fromDateTime (int) : - The starting datetime of the time window
toDateTime (int) : - The ending datetime of the time window
Returns: - The time window object
method init(this, refTimezone, chTimezone, fromDateTime, toDateTime)
init - Initialize the time window object from boolean values of each session day
Namespace types: DateTimeWindow
Parameters:
this (DateTimeWindow) : - The time window object that will hold the from and to datetimes
refTimezone (simple string) : - The timezone of reference of the 'from' and 'to' dates
chTimezone (simple string) : - The target timezone to convert the 'from' and 'to' dates
fromDateTime (int) : - The starting datetime of the time window
toDateTime (int) : - The ending datetime of the time window
Returns: - The time window object
method init(this, sun, mon, tue, wed, thu, fri, sat)
init - Initialize the session days object from boolean values of each session day
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object that will hold the day selection
sun (bool) : - Is Sunday a trading day?
mon (bool) : - Is Monday a trading day?
tue (bool) : - Is Tuesday a trading day?
wed (bool) : - Is Wednesday a trading day?
thu (bool) : - Is Thursday a trading day?
fri (bool) : - Is Friday a trading day?
sat (bool) : - Is Saturday a trading day?
Returns: - The session days object
method init(this, unixTime)
init - Initialize the object from the hour and minute of the session time in exchange timezone (syminfo.timezone)
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
unixTime (int) : - The unix time
Returns: - The session time object
method init(this, hourInDay, minuteInHour)
init - Initialize the object from the hour and minute of the session time in exchange timezone (syminfo.timezone)
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
hourInDay (int) : - The hour of the time
minuteInHour (int) : - The minute of the time
Returns: - The session time object
method init(this, hourInDay, minuteInHour, refTimezone)
init - Initialize the object from the hour and minute of the session time
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
hourInDay (int) : - The hour of the time
minuteInHour (int) : - The minute of the time
refTimezone (string) : - The timezone of reference of the 'hour' and 'minute'
Returns: - The session time object
method init(this, startTime, endTime)
init - Initialize the object from the start and end session time in exchange timezone (syminfo.timezone)
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
startTime (SessionTime) : - The time the session begins
endTime (SessionTime) : - The time the session ends
Returns: - The session time range object
method init(this, startTimeHour, startTimeMinute, endTimeHour, endTimeMinute, refTimezone)
init - Initialize the object from the start and end session time
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
startTimeHour (int) : - The time hour the session begins
startTimeMinute (int) : - The time minute the session begins
endTimeHour (int) : - The time hour the session ends
endTimeMinute (int) : - The time minute the session ends
refTimezone (string)
Returns: - The session time range object
method init(this, days, timeRanges)
init - Initialize the session object from session days and time range
Namespace types: Session
Parameters:
this (Session) : - The session object that will hold the day and the time range selection
days (SessionDays) : - The session days object that defines the days the session is happening
timeRanges (array) : - The array of all the session time ranges during a session day
Returns: - The session object
method init(this, days, timeRanges, names, colors)
init - Initialize the session object from session days and time range
Namespace types: SessionView
Parameters:
this (SessionView) : - The session view object that will hold the session, the names and the color selections
days (SessionDays) : - The session days object that defines the days the session is happening
timeRanges (array) : - The array of all the session time ranges during a session day
names (array) : - The array of the names of the sessions
colors (array) : - The array of the colors of the sessions
Returns: - The session object
method get_size_in_secs(this)
get_size_in_secs - Count the seconds from start to end in the given timeframe
Namespace types: DateTimeWindow
Parameters:
this (DateTimeWindow) : - The time window object with the from and to datetimes
Returns: - The number of seconds inside the time widow for the given timeframe
method get_size_in_secs(this)
get_size_in_secs - Calculate the seconds inside the session
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
Returns: - The number of seconds inside the session
method get_size_in_bars(this)
get_size_in_bars - Count the bars from start to end in the given timeframe
Namespace types: DateTimeWindow
Parameters:
this (DateTimeWindow) : - The time window object with the from and to datetimes
Returns: - The number of bars inside the time widow for the given timeframe
method get_size_in_bars(this)
get_size_in_bars - Calculate the bars inside the session
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
Returns: - The number of bars inside the session for the given timeframe
method is_bar_included(this, offset_forward)
is_bar_included - Check if the given bar is between the start and end dates of the window
Namespace types: DateTimeWindow
Parameters:
this (DateTimeWindow) : - The time window object with the from and to datetimes
offset_forward (simple int) : - The number of bars forward. Default is 1
Returns: - Whether the current bar is inside the datetime window
method is_bar_included(this, offset_forward)
is_bar_included - Check if the given bar is inside the session as defined by the input params (what "not na(time(timeframe.period, this.to_sess_string()) )" should return if you could write it
Namespace types: Session
Parameters:
this (Session) : - The session with the day and the time range selection
offset_forward (simple int) : - The bar forward to check if it is between the from and to datetimes. Default is 1
Returns: - Whether the current time is inside the session
method to_sess_string(this)
to_sess_string - Formats the session days into a session string with day ids
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object
Returns: - The string of the session day ids
method to_sess_string(this)
to_sess_string - Formats the session time into a session string
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
Returns: - The string of the session time
method to_sess_string(this)
to_sess_string - Formats the session time into a session string
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
Returns: - The string of the session time
method to_sess_string(this)
to_sess_string - Formats the session into a session string
Namespace types: Session
Parameters:
this (Session) : - The session object with the day and the time range selection
Returns: - The string of the session
method from_sess_string(this, sess)
from_sess_string - Initialize the session days object from the session string
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object that will hold the day selection
sess (string) : - The session string part that represents the days
Returns: - The session days object
method from_sess_string(this, sess)
from_sess_string - Initialize the session time object from the session string in exchange timezone (syminfo.timezone)
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object that will hold the hour and minute of the time
sess (string) : - The session string part that represents the time HHmm
Returns: - The session time object
method from_sess_string(this, sess, refTimezone)
from_sess_string - Initialize the session time object from the session string
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object that will hold the hour and minute of the time
sess (string) : - The session string part that represents the time HHmm
refTimezone (simple string) : - The timezone of reference of the 'hour' and 'minute'
Returns: - The session time object
method from_sess_string(this, sess)
from_sess_string - Initialize the session time range object from the session string in exchange timezone (syminfo.timezone)
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
sess (string) : - The session string part that represents the time range HHmm-HHmm
Returns: - The session time range object
method from_sess_string(this, sess, refTimezone)
from_sess_string - Initialize the session time range object from the session string
Namespace types: SessionTimeRange
Parameters:
this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
sess (string) : - The session string part that represents the time range HHmm-HHmm
refTimezone (simple string) : - The timezone of reference of the time ranges
Returns: - The session time range object
method from_sess_string(this, sess)
from_sess_string - Initialize the session object from the session string in exchange timezone (syminfo.timezone)
Namespace types: Session
Parameters:
this (Session) : - The session object that will hold the day and the time range selection
sess (string) : - The session string that represents the session HHmm-HHmm,HHmm-HHmm:ddddddd
Returns: - The session time range object
method from_sess_string(this, sess, refTimezone)
from_sess_string - Initialize the session object from the session string
Namespace types: Session
Parameters:
this (Session) : - The session object that will hold the day and the time range selection
sess (string) : - The session string that represents the session HHmm-HHmm,HHmm-HHmm:ddddddd
refTimezone (simple string) : - The timezone of reference of the time ranges
Returns: - The session time range object
method nth_day_after(this, day, n)
nth_day_after - The nth day after the given day that is a session day (true) in the object
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object with the day selection
day (int) : - The day id of the reference day
n (int) : - The number of days after
Returns: - The day id of the nth session day of the week after the given day
method nth_day_before(this, day, n)
nth_day_before - The nth day before the given day that is a session day (true) in the object
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object with the day selection
day (int) : - The day id of the reference day
n (int) : - The number of days after
Returns: - The day id of the nth session day of the week before the given day
method next_day(this)
next_day - The next day that is a session day (true) in the object
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object with the day selection
Returns: - The day id of the next session day of the week
method previous_day(this)
previous_day - The previous day that is session day (true) in the object
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object with the day selection
Returns: - The day id of the previous session day of the week
method get_sec_in_day(this)
get_sec_in_day - Count the seconds since the start of the day this session time represents
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
Returns: - The number of seconds passed from the start of the day until that session time
method get_ms_in_day(this)
get_ms_in_day - Count the milliseconds since the start of the day this session time represents
Namespace types: SessionTime
Parameters:
this (SessionTime) : - The session time object with the hour and minute of the time of the day
Returns: - The number of milliseconds passed from the start of the day until that session time
method is_day_included(this, day)
is_day_included - Check if the given day is inside the session days
Namespace types: SessionDays
Parameters:
this (SessionDays) : - The session days object with the day selection
day (int) : - The day to check if it is a trading day
Returns: - Whether the current day is included in the session days
DateTimeWindow
DateTimeWindow - Object that represents a datetime window with a beginning and an end
Fields:
fromDateTime (series int) : - The beginning of the datetime window
toDateTime (series int) : - The end of the datetime window
SessionDays
SessionDays - Object that represent the trading days of the week
Fields:
days (map) : - The map that contains all days of the week and their session flag
SessionTime
SessionTime - Object that represents the time (hour and minutes)
Fields:
hourInDay (series int) : - The hour of the day that ranges from 0 to 24
minuteInHour (series int) : - The minute of the hour that ranges from 0 to 59
minuteInDay (series int) : - The minute of the day that ranges from 0 to 1440. They will be calculated based on hourInDay and minuteInHour when method is called
SessionTimeRange
SessionTimeRange - Object that represents a range that extends from the start to the end time
Fields:
startTime (SessionTime) : - The beginning of the time range
endTime (SessionTime) : - The end of the time range
isOvernight (series bool) : - Whether or not this is an overnight time range
Session
Session - Object that represents a session
Fields:
days (SessionDays) : - The map of the trading days
timeRanges (array) : - The array with all time ranges of the session during the trading days
SessionView
SessionView - Object that visualize a session
Fields:
sess (Session) : - The Session object to be visualized
names (array) : - The names of the session time ranges
colors (array) : - The colors of the session time ranges
Order Block Drawing [TradingFinder]🔵 Introduction
Perhaps one of the most challenging tasks for Pine script developers (especially beginners) is properly drawing order blocks. While utilizing the latest technical analysis methods for "Price Action," beginners heavily rely on accurately plotting "Supply" and "Demand" zones, following concepts like "Smart Money Concept" and "ICT".
However, drawing "Order Blocks" may pose a challenge for developers. Therefore, to minimize bugs, increase accuracy, and speed up the process of coding order blocks, we have released the "Order Block Drawing" library.
Below, you can read more details about how to use this library.
Important :
This library has direct and indirect outputs. The indirect output includes the ranges of order blocks plotted on the chart. However, the direct output is a "Boolean" value that becomes "true" only when the price touches an order block, colloquially termed as "Mitigate." You can use this output for setting up alerts.
🔵 How to Use
First, you can add the library to your code as shown in the example below.
import TFlab/OrderBlockDrawing_TradingFinder/1
🟣Parameters
OBDrawing(OBType, TriggerCondition, DistalPrice, ProximalPrice, Index, OBValidDis, Show, ColorZone) =>
Parameters:
• OBType (string)
• TriggerCondition (bool)
• DistalPrice (float)
• ProximalPrice (float)
• Index (int)
• OBValidDis (int)
• Show (bool)
• ColorZone (color)
OBType : All order blocks are summarized into two types: "Supply" and "Demand." You should input your order block type in this parameter. Enter "Demand" for drawing demand zones and "Supply" for drawing supply zones.
TriggerCondition : Input the condition under which you want the order block to be drawn in this parameter.
DistalPrice : Generally, if each zone is formed by two lines, the farthest line from the price is termed "Distal." This input receives the price of the "Distal" line.
ProximalPrice : Generally, if each zone is formed by two lines, the nearest line to the price is termed "Proximal" line.
Index : This input receives the value of the "bar_index" at the beginning of the order block. You should store the "bar_index" value at the occurrence of the condition for the order block to be drawn and input it here.
OBValidDis : Order blocks continue to be drawn until a new order block is drawn or the order block is "Mitigate." You can specify how many candles after their initiation order blocks should continue. If you want no limitation, enter the number 4998.
Show : You may need to manage whether to display or hide order blocks. When this input is "On", order blocks are displayed, and when it's "Off", order blocks are not displayed.
ColorZone : You can input your preferred color for drawing order blocks.
🔵 Function Outputs
This function has only one output. This output is of type "Boolean" and becomes "true" only when the price touches an order block. Each order block can be touched only once and then loses its validity. You can use this output for alerts.
= Drawing.OBDrawing('Demand', Condition, Distal, Proximal, Index, 4998, true, Color)
mathLibrary "math"
It's a library of discrete aproximations of a price or Series float it uses Fourier Discrete transform, Laplace Discrete Original and Modified transform and Euler's Theoreum for Homogenus White noice operations. Calling functions without source value it automatically take close as the default source value.
Here is a picture of Laplace and Fourier approximated close prices from this library:
Copy this indicator and try it yourself:
import AutomatedTradingAlgorithms/math/1 as math
//@version=5
indicator("Close Price with Aproximations", shorttitle="Close and Aproximations", overlay=false)
// Sample input data (replace this with your own data)
inputData = close
// Plot Close Price
plot(inputData, color=color.blue, title="Close Price")
ltf32_result = math.LTF32(a=0.01)
plot(ltf32_result, color=color.green, title="LTF32 Aproximation")
fft_result = math.FFT()
plot(fft_result, color=color.red, title="Fourier Aproximation")
wavelet_result = math.Wavelet()
plot(wavelet_result, color=color.orange, title="Wavelet Aproximation")
wavelet_std_result = math.Wavelet_std()
plot(wavelet_std_result, color=color.yellow, title="Wavelet_std Aproximation")
DFT3(xval, _dir)
Discrete Fourier Transform with last 3 points
Parameters:
xval (float) : Source series
_dir (int) : Direction parameter
Returns: Aproxiated source value
DFT2(xval, _dir)
Discrete Fourier Transform with last 2 points
Parameters:
xval (float) : Source series
_dir (int) : Direction parameter
Returns: Aproxiated source value
FFT(xval)
Fast Fourier Transform once. It aproximates usig last 3 points.
Parameters:
xval (float) : Source series
Returns: Aproxiated source value
DFT32(xval)
Combined Discrete Fourier Transforms of DFT3 and DTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
Parameters:
xval (float) : Source series
Returns: Aproxiated source value
DTF32(xval)
Combined Discrete Fourier Transforms of DFT3 and DTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
Parameters:
xval (float) : Source series
Returns: Aproxiated source value
LFT3(xval, _dir, a)
Discrete Laplace Transform with last 3 points
Parameters:
xval (float) : Source series
_dir (int) : Direction parameter
a (float) : laplace coeficient
Returns: Aproxiated source value
LFT2(xval, _dir, a)
Discrete Laplace Transform with last 2 points
Parameters:
xval (float) : Source series
_dir (int) : Direction parameter
a (float) : laplace coeficient
Returns: Aproxiated source value
LFT(xval, a)
Fast Laplace Transform once. It aproximates usig last 3 points.
Parameters:
xval (float) : Source series
a (float) : laplace coeficient
Returns: Aproxiated source value
LFT32(xval, a)
Combined Discrete Laplace Transforms of LFT3 and LTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
Parameters:
xval (float) : Source series
a (float) : laplace coeficient
Returns: Aproxiated source value
LTF32(xval, a)
Combined Discrete Laplace Transforms of LFT3 and LTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
Parameters:
xval (float) : Source series
a (float) : laplace coeficient
Returns: Aproxiated source value
whitenoise(indic_, _devided, minEmaLength, maxEmaLength, src)
Ehler's Universal Oscillator with White Noise, without extra aproximated src.
It uses dinamic EMA to aproximate indicator and thus reducing noise.
Parameters:
indic_ (float) : Input series for the indicator values to be smoothed
_devided (int) : Divisor for oscillator calculations
minEmaLength (int) : Minimum EMA length
maxEmaLength (int) : Maximum EMA length
src (float) : Source series
Returns: Smoothed indicator value
whitenoise(indic_, dft1, _devided, minEmaLength, maxEmaLength, src)
Ehler's Universal Oscillator with White Noise and DFT1.
It uses src and sproxiated src (dft1) to clearly define white noice.
It uses dinamic EMA to aproximate indicator and thus reducing noise.
Parameters:
indic_ (float) : Input series for the indicator values to be smoothed
dft1 (float) : Aproximated src value for white noice calculation
_devided (int) : Divisor for oscillator calculations
minEmaLength (int) : Minimum EMA length
maxEmaLength (int) : Maximum EMA length
src (float) : Source series
Returns: Smoothed indicator value
smooth(dft1, indic__, _devided, minEmaLength, maxEmaLength, src)
Smoothing source value with help of indicator series and aproximated source value
It uses src and sproxiated src (dft1) to clearly define white noice.
It uses dinamic EMA to aproximate src and thus reducing noise.
Parameters:
dft1 (float) : Value to be smoothed.
indic__ (float) : Optional input for indicator to help smooth dft1 (default is FFT)
_devided (int) : Divisor for smoothing calculations
minEmaLength (int) : Minimum EMA length
maxEmaLength (int) : Maximum EMA length
src (float) : Source series
Returns: Smoothed source (src) series
smooth(indic__, _devided, minEmaLength, maxEmaLength, src)
Smoothing source value with help of indicator series
It uses dinamic EMA to aproximate src and thus reducing noise.
Parameters:
indic__ (float) : Optional input for indicator to help smooth dft1 (default is FFT)
_devided (int) : Divisor for smoothing calculations
minEmaLength (int) : Minimum EMA length
maxEmaLength (int) : Maximum EMA length
src (float) : Source series
Returns: Smoothed src series
vzo_ema(src, len)
Volume Zone Oscillator with EMA smoothing
Parameters:
src (float) : Source series
len (simple int) : Length parameter for EMA
Returns: VZO value
vzo_sma(src, len)
Volume Zone Oscillator with SMA smoothing
Parameters:
src (float) : Source series
len (int) : Length parameter for SMA
Returns: VZO value
vzo_wma(src, len)
Volume Zone Oscillator with WMA smoothing
Parameters:
src (float) : Source series
len (int) : Length parameter for WMA
Returns: VZO value
alma2(series, windowsize, offset, sigma)
Arnaud Legoux Moving Average 2 accepts sigma as series float
Parameters:
series (float) : Input series
windowsize (int) : Size of the moving average window
offset (float) : Offset parameter
sigma (float) : Sigma parameter
Returns: ALMA value
Wavelet(src, len, offset, sigma)
Aproxiates srt using Discrete wavelet transform.
Parameters:
src (float) : Source series
len (int) : Length parameter for ALMA
offset (simple float)
sigma (simple float)
Returns: Wavelet-transformed series
Wavelet_std(src, len, offset, mag)
Aproxiates srt using Discrete wavelet transform with standard deviation as a magnitude.
Parameters:
src (float) : Source series
len (int) : Length parameter for ALMA
offset (float) : Offset parameter for ALMA
mag (int) : Magnitude parameter for standard deviation
Returns: Wavelet-transformed series
LaplaceTransform(xval, N, a)
Original Laplace Transform over N set of close prices
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
Returns: Aproxiated source value
NLaplaceTransform(xval, N, a, repeat)
Y repetirions on Original Laplace Transform over N set of close prices, each time N-k set of close prices
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
repeat (int) : number of repetitions
Returns: Aproxiated source value
LaplaceTransformsum(xval, N, a, b)
Sum of 2 exponent coeficient of Laplace Transform over N set of close prices
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
Returns: Aproxiated source value
NLaplaceTransformdiff(xval, N, a, b, repeat)
Difference of 2 exponent coeficient of Laplace Transform over N set of close prices
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
repeat (int) : number of repetitions
Returns: Aproxiated source value
N_divLaplaceTransformdiff(xval, N, a, b, repeat)
N repetitions of Difference of 2 exponent coeficient of Laplace Transform over N set of close prices, with dynamic rotation
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
repeat (int) : number of repetitions
Returns: Aproxiated source value
LaplaceTransformdiff(xval, N, a, b)
Difference of 2 exponent coeficient of Laplace Transform over N set of close prices
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
Returns: Aproxiated source value
NLaplaceTransformdiffFrom2(xval, N, a, b, repeat)
N repetitions of Difference of 2 exponent coeficient of Laplace Transform over N set of close prices, second element has for 1 higher exponent factor
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
repeat (int) : number of repetitions
Returns: Aproxiated source value
N_divLaplaceTransformdiffFrom2(xval, N, a, b, repeat)
N repetitions of Difference of 2 exponent coeficient of Laplace Transform over N set of close prices, second element has for 1 higher exponent factor, dynamic rotation
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
repeat (int) : number of repetitions
Returns: Aproxiated source value
LaplaceTransformdiffFrom2(xval, N, a, b)
Difference of 2 exponent coeficient of Laplace Transform over N set of close prices, second element has for 1 higher exponent factor
Parameters:
xval (float) : series to aproximate
N (int) : number of close prices in calculations
a (float) : laplace coeficient
b (float) : second laplace coeficient
Returns: Aproxiated source value