PINE LIBRARY
Updated ZenLibrary

Library "ZenLibrary"
A collection of custom tools & utility functions commonly used with my scripts.
getDecimals() Calculates how many decimals are on the quote price of the current market
Returns: The current decimal places on the market quote price
truncate(float, float) Truncates (cuts) excess decimal places
Parameters:
float: _number The number to truncate
float: _decimalPlaces (default=2) The number of decimal places to truncate to
Returns: The given _number truncated to the given _decimalPlaces
toWhole(float) Converts pips into whole numbers
Parameters:
float: _number The pip number to convert into a whole number
Returns: The converted number
toPips(float) Converts whole numbers back into pips
Parameters:
float: _number The whole number to convert into pips
Returns: The converted number
av_getPositionSize(float, float, float, float) Calculates OANDA forex position size for AutoView based on the given parameters
Parameters:
float: _balance The account balance to use
float: _risk The risk percentage amount (as a whole number - eg. 1 = 1% risk)
float: _stopPoints The stop loss distance in POINTS (not pips)
float: _conversionRate The conversion rate of our account balance currency
Returns: The calculated position size (in units - only compatible with OANDA)
getMA(int, string) Gets a Moving Average based on type
Parameters:
int: _length The MA period
string: _maType The type of MA
Returns: A moving average with the given parameters
getEAP(float) Performs EAP stop loss size calculation (eg. ATR >= 20.0 and ATR < 30, returns 20)
Parameters:
float: _atr The given ATR to base the EAP SL calculation on
Returns: The EAP SL converted ATR size
barsAboveMA(int, float) Counts how many candles are above the MA
Parameters:
int: _lookback The lookback period to look back over
float: _ma The moving average to check
Returns: The bar count of how many recent bars are above the MA
barsBelowMA(int, float) Counts how many candles are below the MA
Parameters:
int: _lookback The lookback period to look back over
float: _ma The moving average to reference
Returns: The bar count of how many recent bars are below the EMA
barsCrossedMA(int, float) Counts how many times the EMA was crossed recently
Parameters:
int: _lookback The lookback period to look back over
float: _ma The moving average to reference
Returns: The bar count of how many times price recently crossed the EMA
getPullbackBarCount(int, int) Counts how many green & red bars have printed recently (ie. pullback count)
Parameters:
int: _lookback The lookback period to look back over
int: _direction The color of the bar to count (1 = Green, -1 = Red)
Returns: The bar count of how many candles have retraced over the given lookback & direction
getBodySize() Gets the current candle's body size (in POINTS, divide by 10 to get pips)
Returns: The current candle's body size in POINTS
getTopWickSize() Gets the current candle's top wick size (in POINTS, divide by 10 to get pips)
Returns: The current candle's top wick size in POINTS
getBottomWickSize() Gets the current candle's bottom wick size (in POINTS, divide by 10 to get pips)
Returns: The current candle's bottom wick size in POINTS
getBodyPercent() Gets the current candle's body size as a percentage of its entire size including its wicks
Returns: The current candle's body size percentage
isHammer(float, bool) Checks if the current bar is a hammer candle based on the given parameters
Parameters:
float: _fib (default=0.382) The fib to base candle body on
bool: _colorMatch (default=false) Does the candle need to be green? (true/false)
Returns: A boolean - true if the current bar matches the requirements of a hammer candle
isStar(float, bool) Checks if the current bar is a shooting star candle based on the given parameters
Parameters:
float: _fib (default=0.382) The fib to base candle body on
bool: _colorMatch (default=false) Does the candle need to be red? (true/false)
Returns: A boolean - true if the current bar matches the requirements of a shooting star candle
isDoji(float, bool) Checks if the current bar is a doji candle based on the given parameters
Parameters:
float: _wickSize (default=2) The maximum top wick size compared to the bottom (and vice versa)
bool: _bodySize (default=0.05) The maximum body size as a percentage compared to the entire candle size
Returns: A boolean - true if the current bar matches the requirements of a doji candle
isBullishEC(float, float, bool) Checks if the current bar is a bullish engulfing candle
Parameters:
float: _allowance (default=0) How many POINTS to allow the open to be off by (useful for markets with micro gaps)
float: _rejectionWickSize (default=disabled) The maximum rejection wick size compared to the body as a percentage
bool: _engulfWick (default=false) Does the engulfing candle require the wick to be engulfed as well?
Returns: A boolean - true if the current bar matches the requirements of a bullish engulfing candle
isBearishEC(float, float, bool) Checks if the current bar is a bearish engulfing candle
Parameters:
float: _allowance (default=0) How many POINTS to allow the open to be off by (useful for markets with micro gaps)
float: _rejectionWickSize (default=disabled) The maximum rejection wick size compared to the body as a percentage
bool: _engulfWick (default=false) Does the engulfing candle require the wick to be engulfed as well?
Returns: A boolean - true if the current bar matches the requirements of a bearish engulfing candle
timeFilter(string, bool) Determines if the current price bar falls inside the specified session
Parameters:
string: _sess The session to check
bool: _useFilter (default=false) Whether or not to actually use this filter
Returns: A boolean - true if the current bar falls within the given time session
dateFilter(int, int) Determines if this bar's time falls within date filter range
Parameters:
int: _startTime The UNIX date timestamp to begin searching from
int: _endTime the UNIX date timestamp to stop searching from
Returns: A boolean - true if the current bar falls within the given dates
dayFilter(bool, bool, bool, bool, bool, bool, bool) Checks if the current bar's day is in the list of given days to analyze
Parameters:
bool: _monday Should the script analyze this day? (true/false)
bool: _tuesday Should the script analyze this day? (true/false)
bool: _wednesday Should the script analyze this day? (true/false)
bool: _thursday Should the script analyze this day? (true/false)
bool: _friday Should the script analyze this day? (true/false)
bool: _saturday Should the script analyze this day? (true/false)
bool: _sunday Should the script analyze this day? (true/false)
Returns: A boolean - true if the current bar's day is one of the given days
atrFilter(float, float) Checks the current bar's size against the given ATR and max size
Parameters:
float: _atr (default=ATR 14 period) The given ATR to check
float: _maxSize The maximum ATR multiplier of the current candle
Returns: A boolean - true if the current bar's size is less than or equal to _atr x _maxSize
fillCell(table, int, int, string, string, color, color) This updates the given table's cell with the given values
Parameters:
table: _table The table ID to update
int: _column The column to update
int: _row The row to update
string: _title The title of this cell
string: _value The value of this cell
color: _bgcolor The background color of this cell
color: _txtcolor The text color of this cell
Returns: A boolean - true if the current bar falls within the given dates
A collection of custom tools & utility functions commonly used with my scripts.
getDecimals() Calculates how many decimals are on the quote price of the current market
Returns: The current decimal places on the market quote price
truncate(float, float) Truncates (cuts) excess decimal places
Parameters:
float: _number The number to truncate
float: _decimalPlaces (default=2) The number of decimal places to truncate to
Returns: The given _number truncated to the given _decimalPlaces
toWhole(float) Converts pips into whole numbers
Parameters:
float: _number The pip number to convert into a whole number
Returns: The converted number
toPips(float) Converts whole numbers back into pips
Parameters:
float: _number The whole number to convert into pips
Returns: The converted number
av_getPositionSize(float, float, float, float) Calculates OANDA forex position size for AutoView based on the given parameters
Parameters:
float: _balance The account balance to use
float: _risk The risk percentage amount (as a whole number - eg. 1 = 1% risk)
float: _stopPoints The stop loss distance in POINTS (not pips)
float: _conversionRate The conversion rate of our account balance currency
Returns: The calculated position size (in units - only compatible with OANDA)
getMA(int, string) Gets a Moving Average based on type
Parameters:
int: _length The MA period
string: _maType The type of MA
Returns: A moving average with the given parameters
getEAP(float) Performs EAP stop loss size calculation (eg. ATR >= 20.0 and ATR < 30, returns 20)
Parameters:
float: _atr The given ATR to base the EAP SL calculation on
Returns: The EAP SL converted ATR size
barsAboveMA(int, float) Counts how many candles are above the MA
Parameters:
int: _lookback The lookback period to look back over
float: _ma The moving average to check
Returns: The bar count of how many recent bars are above the MA
barsBelowMA(int, float) Counts how many candles are below the MA
Parameters:
int: _lookback The lookback period to look back over
float: _ma The moving average to reference
Returns: The bar count of how many recent bars are below the EMA
barsCrossedMA(int, float) Counts how many times the EMA was crossed recently
Parameters:
int: _lookback The lookback period to look back over
float: _ma The moving average to reference
Returns: The bar count of how many times price recently crossed the EMA
getPullbackBarCount(int, int) Counts how many green & red bars have printed recently (ie. pullback count)
Parameters:
int: _lookback The lookback period to look back over
int: _direction The color of the bar to count (1 = Green, -1 = Red)
Returns: The bar count of how many candles have retraced over the given lookback & direction
getBodySize() Gets the current candle's body size (in POINTS, divide by 10 to get pips)
Returns: The current candle's body size in POINTS
getTopWickSize() Gets the current candle's top wick size (in POINTS, divide by 10 to get pips)
Returns: The current candle's top wick size in POINTS
getBottomWickSize() Gets the current candle's bottom wick size (in POINTS, divide by 10 to get pips)
Returns: The current candle's bottom wick size in POINTS
getBodyPercent() Gets the current candle's body size as a percentage of its entire size including its wicks
Returns: The current candle's body size percentage
isHammer(float, bool) Checks if the current bar is a hammer candle based on the given parameters
Parameters:
float: _fib (default=0.382) The fib to base candle body on
bool: _colorMatch (default=false) Does the candle need to be green? (true/false)
Returns: A boolean - true if the current bar matches the requirements of a hammer candle
isStar(float, bool) Checks if the current bar is a shooting star candle based on the given parameters
Parameters:
float: _fib (default=0.382) The fib to base candle body on
bool: _colorMatch (default=false) Does the candle need to be red? (true/false)
Returns: A boolean - true if the current bar matches the requirements of a shooting star candle
isDoji(float, bool) Checks if the current bar is a doji candle based on the given parameters
Parameters:
float: _wickSize (default=2) The maximum top wick size compared to the bottom (and vice versa)
bool: _bodySize (default=0.05) The maximum body size as a percentage compared to the entire candle size
Returns: A boolean - true if the current bar matches the requirements of a doji candle
isBullishEC(float, float, bool) Checks if the current bar is a bullish engulfing candle
Parameters:
float: _allowance (default=0) How many POINTS to allow the open to be off by (useful for markets with micro gaps)
float: _rejectionWickSize (default=disabled) The maximum rejection wick size compared to the body as a percentage
bool: _engulfWick (default=false) Does the engulfing candle require the wick to be engulfed as well?
Returns: A boolean - true if the current bar matches the requirements of a bullish engulfing candle
isBearishEC(float, float, bool) Checks if the current bar is a bearish engulfing candle
Parameters:
float: _allowance (default=0) How many POINTS to allow the open to be off by (useful for markets with micro gaps)
float: _rejectionWickSize (default=disabled) The maximum rejection wick size compared to the body as a percentage
bool: _engulfWick (default=false) Does the engulfing candle require the wick to be engulfed as well?
Returns: A boolean - true if the current bar matches the requirements of a bearish engulfing candle
timeFilter(string, bool) Determines if the current price bar falls inside the specified session
Parameters:
string: _sess The session to check
bool: _useFilter (default=false) Whether or not to actually use this filter
Returns: A boolean - true if the current bar falls within the given time session
dateFilter(int, int) Determines if this bar's time falls within date filter range
Parameters:
int: _startTime The UNIX date timestamp to begin searching from
int: _endTime the UNIX date timestamp to stop searching from
Returns: A boolean - true if the current bar falls within the given dates
dayFilter(bool, bool, bool, bool, bool, bool, bool) Checks if the current bar's day is in the list of given days to analyze
Parameters:
bool: _monday Should the script analyze this day? (true/false)
bool: _tuesday Should the script analyze this day? (true/false)
bool: _wednesday Should the script analyze this day? (true/false)
bool: _thursday Should the script analyze this day? (true/false)
bool: _friday Should the script analyze this day? (true/false)
bool: _saturday Should the script analyze this day? (true/false)
bool: _sunday Should the script analyze this day? (true/false)
Returns: A boolean - true if the current bar's day is one of the given days
atrFilter(float, float) Checks the current bar's size against the given ATR and max size
Parameters:
float: _atr (default=ATR 14 period) The given ATR to check
float: _maxSize The maximum ATR multiplier of the current candle
Returns: A boolean - true if the current bar's size is less than or equal to _atr x _maxSize
fillCell(table, int, int, string, string, color, color) This updates the given table's cell with the given values
Parameters:
table: _table The table ID to update
int: _column The column to update
int: _row The row to update
string: _title The title of this cell
string: _value The value of this cell
color: _bgcolor The background color of this cell
color: _txtcolor The text color of this cell
Returns: A boolean - true if the current bar falls within the given dates
Release Notes
v2:- Fixed time session filter (it was not working as intended)
Release Notes
v3:- Removed underscore from "_x" parameter names to be consistent with Pine's inbuilt function parameter naming convention
- Removed inbuilt ATR call from function scope in atrFilter() so that it is guaranteed to be calculated properly on every tick (regardless of which scope you place the atrFilter() call in your script)
- Added getPctChange() function - returns the % change between two values over a lookback period
- Cannot remove MA calls from function scope of getMA() in library scripts due to length parameter being dynamic, so make sure to ALWAYS call that function on every calculation (ie. in your main script scope - just as you would with regular inbuilt MA() functions)
Release Notes
v4Changes:
- Changed barsBelowMA and barsAboveMA to use ma instead of current ma value
- Changed timeFilter() to barInSession() - returns true if bar is inside given time session
- Added barOutSession() - returns true if bar is outside given time session
- Added isInsideBar() and isOutsideBar() candle pattern functions
- Added bearFib() and bullFib() fibonacci functions
- Added getEAP2() function - returns an alternative ATR stop loss formula to the getEAP() function
Added:
bullFib(priceLow, priceHigh, fibRatio) Calculates a bullish fibonacci value
Parameters:
priceLow: The lowest price point
priceHigh: The highest price point
fibRatio: The fibonacci % ratio to calculate
Returns: The fibonacci value of the given ratio between the two price points
bearFib(priceLow, priceHigh, fibRatio) Calculates a bearish fibonacci value
Parameters:
priceLow: The lowest price point
priceHigh: The highest price point
fibRatio: The fibonacci % ratio to calculate
Returns: The fibonacci value of the given ratio between the two price points
isInsideBar() Detects inside bars
Returns: Returns true if the current bar is an inside bar
isOutsideBar() Detects outside bars
Returns: Returns true if the current bar is an outside bar
barInSession(string, bool) Determines if the current price bar falls inside the specified session
Parameters:
string: sess The session to check
bool: useFilter (default=true) Whether or not to actually use this filter
Returns: A boolean - true if the current bar falls within the given time session
barOutSession(string, bool) Determines if the current price bar falls outside the specified session
Parameters:
string: sess The session to check
bool: useFilter (default=true) Whether or not to actually use this filter
Returns: A boolean - true if the current bar falls outside the given time session
Removed:
timeFilter(string, bool) Determines if the current price bar falls inside the specified session
Release Notes
Forgot to include export keyword for new getEAP2() function. 🤦♂️Release Notes
v6Added:
getPipSize()
Calculates the pip size of the current market
Returns: The pip size for the current market
Changed:
Improved toWhole() and toPips() function formula to work better across FX/Crypto/Stocks
Fixed bug with barsCrossedMA (it based count on crosses of current MA value instead of MA value for each previous bar)
Release Notes
v7Updated:
getPipSize(multiplier)
Calculates the pip size of the current market
Parameters:
multiplier (int) - The mintick point multiplier (1 by default, 10 for FX/Crypto/CFD if default of 1 is used - only override if your market requires it)
Returns: The pip size for the current market
Release Notes
v8Added some strategy helper functions:
random(minRange, maxRange)
Wichmann–Hill Pseudo-Random Number Generator
Parameters:
minRange (float): The smallest possible number (default: 0)
maxRange (float): The largest possible number (default: 1)
Returns: A random number between minRange and maxRange
tradeCount()
Calculate total trade count
Returns: Total closed trade count
isLong()
Check if we're currently in a long trade
Returns: True if our position size is positive
isShort()
Check if we're currently in a short trade
Returns: True if our position size is negative
isFlat()
Check if we're currentlyflat
Returns: True if our position size is zero
wonTrade()
Check if this bar falls after a winning trade
Returns: True if we just won a trade
lostTrade()
Check if this bar falls after a losing trade
Returns: True if we just lost a trade
maxDrawdownRealized()
Gets the max drawdown based on closed trades (ie. realized P&L). The strategy tester displays max drawdown as open P&L (unrealized).
Returns: The max drawdown based on closed trades (ie. realized P&L). The strategy tester displays max drawdown as open P&L (unrealized).
totalPipReturn()
Gets the total amount of pips won/lost (as a whole number)
Returns: Total amount of pips won/lost (as a whole number)
longWinCount()
Count how many winning long trades we've had
Returns: Long win count
shortWinCount()
Count how many winning short trades we've had
Returns: Short win count
longLossCount()
Count how many losing long trades we've had
Returns: Long loss count
shortLossCount()
Count how many losing short trades we've had
Returns: Short loss count
breakEvenCount(allowanceTicks)
Count how many break-even trades we've had
Parameters:
allowanceTicks (float): Optional - how many ticks to allow between entry & exit price (default 0)
Returns: Break-even count
longCount()
Count how many long trades we've taken
Returns: Long trade count
shortCount()
Count how many short trades we've taken
Returns: Short trade count
longWinPercent()
Calculate win rate of long trades
Returns: Long win rate (0-100)
shortWinPercent()
Calculate win rate of short trades
Returns: Short win rate (0-100)
breakEvenPercent(allowanceTicks)
Calculate break even rate of all trades
Parameters:
allowanceTicks (float): Optional - how many ticks to allow between entry & exit price (default 0)
Returns: Break-even win rate (0-100)
averageRR()
Calculate average risk:reward
Returns: Average winning trade divided by average losing trade
unitsToLots(units)
(Forex) Convert the given unit count to lots (multiples of 100,000)
Parameters:
units (float): The units to convert into lots
Returns: Units converted to nearest lot size (as float)
getFxPositionSize(balance, risk, stopLossPips, fxRate, lots)
(Forex) Calculate fixed-fractional position size based on given parameters
Parameters:
balance (float): The account balance
risk (float): The % risk (whole number)
stopLossPips (float): Pip distance to base risk on
fxRate (float): The conversion currency rate (more info below in library documentation)
lots (bool): Whether or not to return the position size in lots rather than units (true by default)
Returns: Units/lots to enter into "qty=" parameter of strategy entry function
EXAMPLE USAGE:
string conversionCurrencyPair = (strategy.account_currency == syminfo.currency ? syminfo.tickerid : strategy.account_currency + syminfo.currency)
float fx_rate = request.security(conversionCurrencyPair, timeframe.period, close[barstate.isrealtime ? 1 : 0])[barstate.isrealtime ? 0 : 1]
if (longCondition)
strategy.entry("Long", strategy.long, qty=zen.getFxPositionSize(strategy.equity, 1, stopLossPipsWholeNumber, fx_rate, true))
skipTradeMonteCarlo(chance, debug)
Checks to see if trade should be skipped to emulate rudimentary Monte Carlo simulation
Parameters:
chance (float): The chance to skip a trade (0-1 or 0-100, function will normalize to 0-1)
debug (bool): Whether or not to display a label informing of the trade skip
Returns: True if the trade is skipped, false if it's not skipped (idea being to include this function in entry condition validation checks)
Updated:
Fixed param commenting on all functions so code hints work properly in the Pine editor.
Removed (redundant/no longer should be used):
av_getPositionSize(balance, risk, stopPoints, conversionRate)
Calculates OANDA forex position size for AutoView based on the given parameters
getEAP(atr)
Performs EAP stop loss size calculation (eg. ATR >= 20.0 and ATR < 30, returns 20)
getEAP2(atr)
Performs secondary EAP stop loss size calculation (eg. ATR < 40, add 5 pips, ATR between 40-50, add 10 pips etc)
Release Notes
v9Updated script to Pine Script version 6. Utilized new ability to use security function in libraries to streamline the forex fixed-fractional position sizing function.
Updated:
getFxPositionSize(balance, risk, stopLossPips, lots, fxRate, symbolOverride)
(Forex) Calculate fixed-fractional position size based on given parameters
Parameters:
balance (float): The account balance
risk (float): The % risk (whole number)
stopLossPips (float): Pip distance to base risk on
lots (bool): Whether or not to return the position size in lots rather than units (true by default)
fxRate (float): The conversion currency rate (-1 by default - script will auto-detect FX conversion pair, more info below in library documentation)
symbolOverride (string): Directly specify the symbol to use for currency conversion (blank by default)
Returns: Units/lots to enter into "qty=" parameter of strategy entry function
EXAMPLE USAGE:
if (longCondition) // Risk 1%
strategy.entry("Long", strategy.long, qty=zen.getFxPositionSize(strategy.equity, 1, stopLossPipsWholeNumber))
Release Notes
v10:Tweaked getFxPositionSize() to take advantage of more Pine v6 functionality.
It now supports using strategy.equity for position size calculations, which is the default behaviour if you leave the "balance" parameter unassigned.
Also added the ability to specify the timeframe for currency conversions by adding a new parameter (useCurrentTF - false by default).
The library now uses the "D" daily timeframe for all currency conversions by default. This makes this FX position sizing function far more compatible with the bar replay feature, as the limitation of request.security()'s access to limited historical bars is no longer as problematic when running on the lower intraday timeframes.
In other words, the default behaviour of this function is to now use the previous historical end-of-day FX rates for the position size calculations instead of the current intrabar prices. This shouldn't affect the calculation's accuracy much, but enables the script to run on far more historical bars in the bar replay mode.
To force the function to use matching intrabar data for more accurate bar-by-bar currency conversion rates simply set the parameter "useCurrentTF=true" - but note that doing this will likely break the position sizing calculations within the bar replay feature.
Updated:
getFxPositionSize(risk, stopLossPips, lots, balance, fxRate, symbolOverride, useCurrentTF)
(Forex) Calculate fixed-fractional position size based on given parameters
Parameters:
risk (float): The % risk (whole number)
stopLossPips (float): Pip distance to base risk on
lots (bool): Whether or not to return the position size in lots rather than units (true by default)
balance (float): The account balance
fxRate (float): The conversion currency rate (-1 by default - script will auto-detect FX conversion pair, more info below in library documentation)
symbolOverride (string): Directly specify the symbol to use for currency conversion (blank by default)
useCurrentTF (bool): Use the matching intrabar for currency conversion instead of daily FX data - note: this will give more accurate conversion FX rates, but limits bar replay functionality
Returns: Units/lots to enter into "qty=" parameter of strategy entry function
EXAMPLE USAGE:
if (longCondition) // Risk 1%
strategy.entry("Long", strategy.long, qty=zen.getFxPositionSize(1, stopLossPipsWholeNumber, true, strategy.equity))
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
My Resources Hub: theartoftrading.com
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
My Resources Hub: theartoftrading.com
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.