[SGM Ordinal Patterns]An ordinal pattern is a concept used in mathematics and time series analysis. It is a way of describing the relative order of values in a sequence. Rather than focusing on the exact values, we are interested in how they compare to each other.
An ordinal pattern will tell you how these values are positioned relative to each other.
We do not look at the exact values, but only their order.
Concrete Example
• 4 (position 1 in the original sequence) is in position 2 in the ordered sequence.
• 7 (position 2 in the original sequence) is in position 3 in the ordered sequence.
• 2 (position 3 in the original sequence) is in position 1 in the ordered sequence.
The ordinal pattern for this sequence is then (2,3,1)(2, 3, 1)(2,3,1).
Script Explanation
This script analyzes ordinal patterns based on the closing prices of the last three bars and calculates the future gains associated with each ordinal pattern.
The main elements of the script are:
1. ordinal_pattern Function:
o Determines the ordinal pattern based on three past closing values.
o Returns an index (from 0 to 5) corresponding to one of the six possible ordinal patterns.
2. Calculations and Storage:
o For each new bar, the last three closes are used to identify the ordinal pattern.
o Future gains are calculated and associated with the previous ordinal pattern.
o Return statistics (mean, standard deviation and Sharpe ratio) are calculated for each pattern.
3. Visualization:
o Draws lines connecting the last three closes.
o Tables displaying the number of occurrences, distributions, and return statistics for each ordinal pattern.
What the Script Shows:
• Table motifs_table : Number of occurrences and distribution of each ordinal pattern. An uneven distribution between patterns (different by one sixth for each pattern) can indicate market inefficiency.
• Table pattern_analysis : Analysis of returns (mean, standard deviation, Sharpe ratio) for each ordinal pattern.
• Table current_motif_table : Ordinal pattern of the last bar.
This script helps to understand and visualize how ordinal patterns influence future returns of financial asset prices. An uneven distribution of patterns can indicate market inefficiencies.
Statistics
Oscillator Scatterplot Analysis [Trendoscope®]In this indicator, we demonstrate how to plot oscillator behavior of oversold-overbought against price movements in the form of scatterplots and perform analysis. Scatterplots are drawn on a graph containing x and y-axis, where x represent one measure whereas y represents another. We use the library Graph to collect the data and plot it as scatterplot.
Pictorial explanation of components is defined in the chart below.
🎲 This indicator performs following tasks
Calculate and plot oscillator
Identify oversold and overbought areas based on various methods
Measure the price and bar movement from overbought to oversold and vice versa and plot them on the chart.
In our example,
The x-axis represents price movement. The plots found on the right side of the graph has positive price movements, whereas the plots found on the left side of the graph has negative price movements.
The y-axis represents the number of bars it took for reaching overbought to oversold and/or oversold to overbought. Positive bars mean we are measuring oversold to overbought, whereas negative bars are a measure of overbought to oversold.
🎲 Graph is divided into 4 equal quadrants
Quadrant 1 is the top right portion of the graph. Plots in this quadrant represent the instances where positive price movement is observed when the oscillator moved from oversold to overbought
Quadrant 2 is the top left portion of the graph. Plots in this quadrant represent the instances where negative price movement is observed when the oscillator moved from oversold to overbought.
Quadrant 3 is the bottom left portion of the chart. Plots in this quadrant represent the instances where negative price movement is observed when the oscillator moved from overbought to oversold.
Quadrant 4 is the bottom right portion of the chart. Plots in this quadrant represent the instances where positive price movement is observed when the oscillator moved from overbought to oversold.
🎲 Indicator components in Detail
Let's dive deep into the indicator.
🎯 Oscillator Selection
Select the Oscillator and define the overbought oversold conditions through input settings
Indicator - Oscillator base used for performing analysis
Length - Loopback length on which the oscillator is calculated
OB/OS Method - We use Bollinger Bands, Keltener Channel and Donchian channel to calculate dynamic overbought and oversold levels instead of static 80-10. This is also useful as other type of indicators may not be within 0-100 range.
Length and Multiplier are used for the bands for calculating Overbought/Oversold boundaries.
🎯 Define Graph Properties
Select different graph properties from the input settings that will instruct how to display the scatterplot.
Type - this can be either scatterplot or heatmap. Scatterplot will display plots with specific transparency to indicate the data, whereas heatmap will display background with different transparencies.
Plot Color - this is the color in which the scatterplot or heatmap is drawn
Plot Size - applicable mainly for scatterplot. Since the character we use for scatterplot is very tiny, the large at present looks optimal. But, based on the user's screen size, we may need to select different sizes so that it will render properly.
Rows and Columns - Number of rows and columns allocated per quadrant. This means, the total size of the chart is 2X rows and 2X columns. Data sets are divided into buckets based on the number of available rows and columns. Hence, changing this can change the appearance of the overall chart, even though they are representing the same data. Also, please note that tables can have max 10000 cells. If we increase the rows and columns by too much, we may get runtime errors.
Outliers - this is used to exclude the extreme data. 20% outlier means, the chart will ignore bottom 20% and top 20% when defining the chart boundaries. However, the extreme data is still added to the boundaries.
Self Optimizing RSI and Self Adaptive TP/SL [Starbots]Self Optimizing RSI and Self Adaptive TP/SL Strategy. (non-repainting)
This script continuously backtests 20 different combinations of RSI Buy conditions across 5 different Take Profit/Stop Loss combinations. In total, it tests 100 variants on every bar close and records the Net Profit gained for each combination. The strategy then selects and uses the best-performing combination of settings currently available for you to trade.
---------------------------------------------------------------------------------------------------------
The Relative Strength Index (RSI), developed by J. Welles Wilder, is a momentum oscillator that measures the speed and change of price movements. The RSI oscillates between zero and 100. Traditionally the RSI is considered overbought when above 70 and oversold when below 30. Signals can be generated by looking for divergences and failure swings. RSI can also be used to identify the general trend.
To improve our results we are calculating Multiple Length RSI - Average RSI based on the multiple periods. You can use just 1 Length or Multiple.
Set Inputs to Min=14, Max=14 if you want to use just 1 period.
= RSI(14)
3 RSI Lengths example (12,13 and 14):
Min=12, Max=14
(12+13+14) / 3 = avg. RSI
-----------------------------------------------------------------------------------------------------------
Backtester - Optimizer Explained:
The backtester runs numerous backtests in the background to optimize trading strategies. Here’s how it works:
Default Inputs (Combinations of TP/SL)
TP 1%, SL4%
TP 2%, SL4%
TP 3%, SL4%
TP 2%, SL5%
TP 4.5%, SL10%
Default Inputs (RSI Crossover Buys) :
18 ,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,45,55, 69
_______________________________________________________
Backtest RSI Crossover 18:
TP1%, SL4% => Save net profit
TP2%, SL4% => Save net profit
TP3%, SL4% => Save net profit
TP2%, SL5% => Save net profit
TP4.5%, SL10% => Save net profit
,...
,...
Backtest RSI Crossover 69:
TP1%, SL4% => Save net profit
TP2%, SL4% => Save net profit
TP3%, SL4% => Save net profit
TP2%, SL5% => Save net profit
TP4.5%, SL10% => Save net profit
Self Optimizing Buy Condition and Self Optimizing Take Profit - Stop Los
This process involves testing various combinations of RSI crossover values with different Take Profit (TP) and Stop Loss (SL) percentages. The net profit for each combination is saved, allowing the optimizer to select the best-performing settings for trading.
It recalculates on every bar close. If one combination starts performing better than others—achieving a higher net profit gain (essentially like running 100 backtests with different settings in the background)—the strategy switches to that combination of TP/SL and Buy condition. It continues trading with the new settings until another parameter starts performing better and the strategy switches to that setting.
________________________________________________________________________
If you wish to use it as INDICATOR - turn on 'Recalculate - On every tick' in Properties tab to have this script updating constantly and use it as a normal Indicator tool for manual trading.
Other functions:
Set the %fee for optimizing engine. If you set this % higher, you also punish small average trades and make the strategy prefer larger avg. trades, giving you better chances to make your strategy profitable.
Trade with trend and optimize the strategy only when the market is uptrending with EMA/HMA
Use Moving Average of avg.RSI and smooth the values for indicator even more. (Yes strategy is self optimizing RSI or avg.RSI or RSI-MA, you can select all sorts of this indicator for optimizing)
All trading alerts are working and functional, if you want to automate the strategy
This script is simple to use for any trader as it saves a lot of time for searching good parameters on your own. It's self-optimizing and adjusting to the markets on the go.
GraphLibrary "Graph"
Library to collect data and draw scatterplot and heatmap as graph
method init(this)
Initialise Quadrant Data
Namespace types: Quadrant
Parameters:
this (Quadrant) : Quadrant object that needs to be initialised
Returns: current Quadrant object
method init(this)
Initialise Graph Data
Namespace types: Graph
Parameters:
this (Graph) : Graph object that needs to be initialised with 4 Quadrants
Returns: current Graph object
method add(this, data)
Add coordinates to graph
Namespace types: Graph
Parameters:
this (Graph) : Graph object
data (Coordinate) : Coordinates containing x, y data
Returns: current Graph object
method calculate(this)
Calculation required for plotting the graph
Namespace types: Graph
Parameters:
this (Graph) : Graph object
Returns: current Graph object
method paint(this)
Draw graph
Namespace types: Graph
Parameters:
this (Graph) : Graph object
Returns: current Graph object
Coordinate
Coordinates of sample data
Fields:
xValue (series float) : x value of the sample data
yValue (series float) : y value of the sample data
Quadrant
Data belonging to particular quadrant
Fields:
coordinates (array) : Coordinates present in given quadrant
GraphProperties
Properties of Graph that needs to be drawn
Fields:
rows (series int) : Number of rows (y values) in each quadrant
columns (series int) : number of columns (x values) in each quadrant
graphtype (series GraphType) : Type of graph - scatterplot or heatmap
plotColor (series color) : color of plots or heatmap
plotSize (series string) : size of cells in the table
plotchar (series string) : Character to be printed for display of scatterplot
outliers (series int) : Excude the outlier percent of data from calculating the min and max
position (series string) : Table position
bgColor (series color) : graph background color
PlotRange
Range of a plot in terms of x and y values and the number of data points that fall within the Range
Fields:
minX (series float) : min range of X value
maxX (series float) : max range of X value
minY (series float) : min range of Y value
maxY (series float) : max range of Y value
count (series int) : number of samples in the range
Graph
Graph data and properties
Fields:
properties (GraphProperties) : Graph Properties object associated
quadrants (array) : Array containing 4 quadrant data
plotRanges (matrix) : range and count for each cell
xArray (array) : array of x values
yArray (array) : arrray of y values
PubLibPatternLibrary "PubLibPattern"
pattern conditions for indicator and strategy development
bear_5_0(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish 5-0 harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_5_0(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish 5-0 harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_abcd(bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish abcd harmonic pattern condition
Parameters:
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_abcd(bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish abcd harmonic pattern condition
Parameters:
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_alt_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish alternate bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_alt_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish alternate bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_bat(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish bat harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_butterfly(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish butterfly harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_butterfly(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish butterfly harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_cassiopeia_a(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish cassiopeia a harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_cassiopeia_a(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish cassiopeia a harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_cassiopeia_b(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish cassiopeia b harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_cassiopeia_b(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish cassiopeia b harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_cassiopeia_c(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bearish cassiopeia c harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bull_cassiopeia_c(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol)
bullish cassiopeia c harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
Returns: bool
bear_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_deep_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish deep crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_deep_crab(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish deep crab harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_cypher(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, xc_low_tol, xc_up_tol)
bearish cypher harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bull_cypher(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, xc_low_tol, xc_up_tol)
bullish cypher harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bear_gartley(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bearish gartley harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bull_gartley(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, cd_low_tol, cd_up_tol, ad_low_tol, ad_up_tol)
bullish gartley harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
cd_low_tol (float)
cd_up_tol (float)
ad_low_tol (float)
ad_up_tol (float)
Returns: bool
bear_shark(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, xc_low_tol, xc_up_tol)
bearish shark harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bull_shark(ab_low_tol, ab_up_tol, bc_low_tol, bc_up_tol, xc_low_tol, xc_up_tol)
bullish shark harmonic pattern condition
Parameters:
ab_low_tol (float)
ab_up_tol (float)
bc_low_tol (float)
bc_up_tol (float)
xc_low_tol (float)
xc_up_tol (float)
Returns: bool
bear_three_drive(x1_low_tol, a1_low_tol, a1_up_tol, a2_low_tol, a2_up_tol, b2_low_tol, b2_up_tol, b3_low_tol, b3_upt_tol)
bearish three drive harmonic pattern condition
Parameters:
x1_low_tol (float)
a1_low_tol (float)
a1_up_tol (float)
a2_low_tol (float)
a2_up_tol (float)
b2_low_tol (float)
b2_up_tol (float)
b3_low_tol (float)
b3_upt_tol (float)
Returns: bool
bull_three_drive(x1_low_tol, a1_low_tol, a1_up_tol, a2_low_tol, a2_up_tol, b2_low_tol, b2_up_tol, b3_low_tol, b3_upt_tol)
bullish three drive harmonic pattern condition
Parameters:
x1_low_tol (float)
a1_low_tol (float)
a1_up_tol (float)
a2_low_tol (float)
a2_up_tol (float)
b2_low_tol (float)
b2_up_tol (float)
b3_low_tol (float)
b3_upt_tol (float)
Returns: bool
asc_broadening()
ascending broadening pattern condition
Returns: bool
broadening()
broadening pattern condition
Returns: bool
desc_broadening()
descending broadening pattern condition
Returns: bool
double_bot(low_tol, up_tol)
double bottom pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
double_top(low_tol, up_tol)
double top pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
triple_bot(low_tol, up_tol)
triple bottom pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
triple_top(low_tol, up_tol)
triple top pattern condition
Parameters:
low_tol (float)
up_tol (float)
Returns: bool
bear_elliot()
bearish elliot wave pattern condition
Returns: bool
bull_elliot()
bullish elliot wave pattern condition
Returns: bool
bear_alt_flag(ab_ratio, bc_ratio)
bearish alternate flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
bull_alt_flag(ab_ratio, bc_ratio)
bullish alternate flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
bear_flag(ab_ratio, bc_ratio, be_ratio)
bearish flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
be_ratio (float)
Returns: bool
bull_flag(ab_ratio, bc_ratio, be_ratio)
bullish flag pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
be_ratio (float)
Returns: bool
bear_asc_head_shoulders()
bearish ascending head and shoulders pattern condition
Returns: bool
bull_asc_head_shoulders()
bullish ascending head and shoulders pattern condition
Returns: bool
bear_desc_head_shoulders()
bearish descending head and shoulders pattern condition
Returns: bool
bull_desc_head_shoulders()
bullish descending head and shoulders pattern condition
Returns: bool
bear_head_shoulders()
bearish head and shoulders pattern condition
Returns: bool
bull_head_shoulders()
bullish head and shoulders pattern condition
Returns: bool
bear_pennant(ab_ratio, bc_ratio)
bearish pennant pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
bull_pennant(ab_ratio, bc_ratio)
bullish pennant pattern condition
Parameters:
ab_ratio (float)
bc_ratio (float)
Returns: bool
asc_wedge()
ascending wedge pattern condition
Returns: bool
desc_wedge()
descending wedge pattern condition
Returns: bool
wedge()
wedge pattern condition
Returns: bool
AsianRange, KillZones, RSI Bars, and Supertrend Strategy by VKombinacija AsianRange, KillZones, RSI Bars, and Supertrend Strategy
PubLibTrendLibrary "PubLibTrend"
trend, multi-part trend, double trend and multi-part double trend conditions for indicator and strategy development
rlut()
return line uptrend condition
Returns: bool
dt()
downtrend condition
Returns: bool
ut()
uptrend condition
Returns: bool
rldt()
return line downtrend condition
Returns: bool
dtop()
double top condition
Returns: bool
dbot()
double bottom condition
Returns: bool
rlut_1p()
1-part return line uptrend condition
Returns: bool
rlut_2p()
2-part return line uptrend condition
Returns: bool
rlut_3p()
3-part return line uptrend condition
Returns: bool
rlut_4p()
4-part return line uptrend condition
Returns: bool
rlut_5p()
5-part return line uptrend condition
Returns: bool
rlut_6p()
6-part return line uptrend condition
Returns: bool
rlut_7p()
7-part return line uptrend condition
Returns: bool
rlut_8p()
8-part return line uptrend condition
Returns: bool
rlut_9p()
9-part return line uptrend condition
Returns: bool
rlut_10p()
10-part return line uptrend condition
Returns: bool
rlut_11p()
11-part return line uptrend condition
Returns: bool
rlut_12p()
12-part return line uptrend condition
Returns: bool
rlut_13p()
13-part return line uptrend condition
Returns: bool
rlut_14p()
14-part return line uptrend condition
Returns: bool
rlut_15p()
15-part return line uptrend condition
Returns: bool
rlut_16p()
16-part return line uptrend condition
Returns: bool
rlut_17p()
17-part return line uptrend condition
Returns: bool
rlut_18p()
18-part return line uptrend condition
Returns: bool
rlut_19p()
19-part return line uptrend condition
Returns: bool
rlut_20p()
20-part return line uptrend condition
Returns: bool
rlut_21p()
21-part return line uptrend condition
Returns: bool
rlut_22p()
22-part return line uptrend condition
Returns: bool
rlut_23p()
23-part return line uptrend condition
Returns: bool
rlut_24p()
24-part return line uptrend condition
Returns: bool
rlut_25p()
25-part return line uptrend condition
Returns: bool
rlut_26p()
26-part return line uptrend condition
Returns: bool
rlut_27p()
27-part return line uptrend condition
Returns: bool
rlut_28p()
28-part return line uptrend condition
Returns: bool
rlut_29p()
29-part return line uptrend condition
Returns: bool
rlut_30p()
30-part return line uptrend condition
Returns: bool
dt_1p()
1-part downtrend condition
Returns: bool
dt_2p()
2-part downtrend condition
Returns: bool
dt_3p()
3-part downtrend condition
Returns: bool
dt_4p()
4-part downtrend condition
Returns: bool
dt_5p()
5-part downtrend condition
Returns: bool
dt_6p()
6-part downtrend condition
Returns: bool
dt_7p()
7-part downtrend condition
Returns: bool
dt_8p()
8-part downtrend condition
Returns: bool
dt_9p()
9-part downtrend condition
Returns: bool
dt_10p()
10-part downtrend condition
Returns: bool
dt_11p()
11-part downtrend condition
Returns: bool
dt_12p()
12-part downtrend condition
Returns: bool
dt_13p()
13-part downtrend condition
Returns: bool
dt_14p()
14-part downtrend condition
Returns: bool
dt_15p()
15-part downtrend condition
Returns: bool
dt_16p()
16-part downtrend condition
Returns: bool
dt_17p()
17-part downtrend condition
Returns: bool
dt_18p()
18-part downtrend condition
Returns: bool
dt_19p()
19-part downtrend condition
Returns: bool
dt_20p()
20-part downtrend condition
Returns: bool
dt_21p()
21-part downtrend condition
Returns: bool
dt_22p()
22-part downtrend condition
Returns: bool
dt_23p()
23-part downtrend condition
Returns: bool
dt_24p()
24-part downtrend condition
Returns: bool
dt_25p()
25-part downtrend condition
Returns: bool
dt_26p()
26-part downtrend condition
Returns: bool
dt_27p()
27-part downtrend condition
Returns: bool
dt_28p()
28-part downtrend condition
Returns: bool
dt_29p()
29-part downtrend condition
Returns: bool
dt_30p()
30-part downtrend condition
Returns: bool
ut_1p()
1-part uptrend condition
Returns: bool
ut_2p()
2-part uptrend condition
Returns: bool
ut_3p()
3-part uptrend condition
Returns: bool
ut_4p()
4-part uptrend condition
Returns: bool
ut_5p()
5-part uptrend condition
Returns: bool
ut_6p()
6-part uptrend condition
Returns: bool
ut_7p()
7-part uptrend condition
Returns: bool
ut_8p()
8-part uptrend condition
Returns: bool
ut_9p()
9-part uptrend condition
Returns: bool
ut_10p()
10-part uptrend condition
Returns: bool
ut_11p()
11-part uptrend condition
Returns: bool
ut_12p()
12-part uptrend condition
Returns: bool
ut_13p()
13-part uptrend condition
Returns: bool
ut_14p()
14-part uptrend condition
Returns: bool
ut_15p()
15-part uptrend condition
Returns: bool
ut_16p()
16-part uptrend condition
Returns: bool
ut_17p()
17-part uptrend condition
Returns: bool
ut_18p()
18-part uptrend condition
Returns: bool
ut_19p()
19-part uptrend condition
Returns: bool
ut_20p()
20-part uptrend condition
Returns: bool
ut_21p()
21-part uptrend condition
Returns: bool
ut_22p()
22-part uptrend condition
Returns: bool
ut_23p()
23-part uptrend condition
Returns: bool
ut_24p()
24-part uptrend condition
Returns: bool
ut_25p()
25-part uptrend condition
Returns: bool
ut_26p()
26-part uptrend condition
Returns: bool
ut_27p()
27-part uptrend condition
Returns: bool
ut_28p()
28-part uptrend condition
Returns: bool
ut_29p()
29-part uptrend condition
Returns: bool
ut_30p()
30-part uptrend condition
Returns: bool
rldt_1p()
1-part return line downtrend condition
Returns: bool
rldt_2p()
2-part return line downtrend condition
Returns: bool
rldt_3p()
3-part return line downtrend condition
Returns: bool
rldt_4p()
4-part return line downtrend condition
Returns: bool
rldt_5p()
5-part return line downtrend condition
Returns: bool
rldt_6p()
6-part return line downtrend condition
Returns: bool
rldt_7p()
7-part return line downtrend condition
Returns: bool
rldt_8p()
8-part return line downtrend condition
Returns: bool
rldt_9p()
9-part return line downtrend condition
Returns: bool
rldt_10p()
10-part return line downtrend condition
Returns: bool
rldt_11p()
11-part return line downtrend condition
Returns: bool
rldt_12p()
12-part return line downtrend condition
Returns: bool
rldt_13p()
13-part return line downtrend condition
Returns: bool
rldt_14p()
14-part return line downtrend condition
Returns: bool
rldt_15p()
15-part return line downtrend condition
Returns: bool
rldt_16p()
16-part return line downtrend condition
Returns: bool
rldt_17p()
17-part return line downtrend condition
Returns: bool
rldt_18p()
18-part return line downtrend condition
Returns: bool
rldt_19p()
19-part return line downtrend condition
Returns: bool
rldt_20p()
20-part return line downtrend condition
Returns: bool
rldt_21p()
21-part return line downtrend condition
Returns: bool
rldt_22p()
22-part return line downtrend condition
Returns: bool
rldt_23p()
23-part return line downtrend condition
Returns: bool
rldt_24p()
24-part return line downtrend condition
Returns: bool
rldt_25p()
25-part return line downtrend condition
Returns: bool
rldt_26p()
26-part return line downtrend condition
Returns: bool
rldt_27p()
27-part return line downtrend condition
Returns: bool
rldt_28p()
28-part return line downtrend condition
Returns: bool
rldt_29p()
29-part return line downtrend condition
Returns: bool
rldt_30p()
30-part return line downtrend condition
Returns: bool
dut()
double uptrend condition
Returns: bool
ddt()
double downtrend condition
Returns: bool
dut_1p()
1-part double uptrend condition
Returns: bool
dut_2p()
2-part double uptrend condition
Returns: bool
dut_3p()
3-part double uptrend condition
Returns: bool
dut_4p()
4-part double uptrend condition
Returns: bool
dut_5p()
5-part double uptrend condition
Returns: bool
dut_6p()
6-part double uptrend condition
Returns: bool
dut_7p()
7-part double uptrend condition
Returns: bool
dut_8p()
8-part double uptrend condition
Returns: bool
dut_9p()
9-part double uptrend condition
Returns: bool
dut_10p()
10-part double uptrend condition
Returns: bool
dut_11p()
11-part double uptrend condition
Returns: bool
dut_12p()
12-part double uptrend condition
Returns: bool
dut_13p()
13-part double uptrend condition
Returns: bool
dut_14p()
14-part double uptrend condition
Returns: bool
dut_15p()
15-part double uptrend condition
Returns: bool
dut_16p()
16-part double uptrend condition
Returns: bool
dut_17p()
17-part double uptrend condition
Returns: bool
dut_18p()
18-part double uptrend condition
Returns: bool
dut_19p()
19-part double uptrend condition
Returns: bool
dut_20p()
20-part double uptrend condition
Returns: bool
dut_21p()
21-part double uptrend condition
Returns: bool
dut_22p()
22-part double uptrend condition
Returns: bool
dut_23p()
23-part double uptrend condition
Returns: bool
dut_24p()
24-part double uptrend condition
Returns: bool
dut_25p()
25-part double uptrend condition
Returns: bool
dut_26p()
26-part double uptrend condition
Returns: bool
dut_27p()
27-part double uptrend condition
Returns: bool
dut_28p()
28-part double uptrend condition
Returns: bool
dut_29p()
29-part double uptrend condition
Returns: bool
dut_30p()
30-part double uptrend condition
Returns: bool
ddt_1p()
1-part double downtrend condition
Returns: bool
ddt_2p()
2-part double downtrend condition
Returns: bool
ddt_3p()
3-part double downtrend condition
Returns: bool
ddt_4p()
4-part double downtrend condition
Returns: bool
ddt_5p()
5-part double downtrend condition
Returns: bool
ddt_6p()
6-part double downtrend condition
Returns: bool
ddt_7p()
7-part double downtrend condition
Returns: bool
ddt_8p()
8-part double downtrend condition
Returns: bool
ddt_9p()
9-part double downtrend condition
Returns: bool
ddt_10p()
10-part double downtrend condition
Returns: bool
ddt_11p()
11-part double downtrend condition
Returns: bool
ddt_12p()
12-part double downtrend condition
Returns: bool
ddt_13p()
13-part double downtrend condition
Returns: bool
ddt_14p()
14-part double downtrend condition
Returns: bool
ddt_15p()
15-part double downtrend condition
Returns: bool
ddt_16p()
16-part double downtrend condition
Returns: bool
ddt_17p()
17-part double downtrend condition
Returns: bool
ddt_18p()
18-part double downtrend condition
Returns: bool
ddt_19p()
19-part double downtrend condition
Returns: bool
ddt_20p()
20-part double downtrend condition
Returns: bool
ddt_21p()
21-part double downtrend condition
Returns: bool
ddt_22p()
22-part double downtrend condition
Returns: bool
ddt_23p()
23-part double downtrend condition
Returns: bool
ddt_24p()
24-part double downtrend condition
Returns: bool
ddt_25p()
25-part double downtrend condition
Returns: bool
ddt_26p()
26-part double downtrend condition
Returns: bool
ddt_27p()
27-part double downtrend condition
Returns: bool
ddt_28p()
28-part double downtrend condition
Returns: bool
ddt_29p()
29-part double downtrend condition
Returns: bool
ddt_30p()
30-part double downtrend condition
Returns: bool
PubLibSwingLibrary "PubLibSwing"
swing high and swing low conditions, prices, bar indices and range ratios for indicator and strategy development
sh()
swing high condition
Returns: bool
sl()
swing low condition
Returns: bool
shbi(occ)
swing high bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
slbi(occ)
swing low bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
shcp(occ)
swing high close price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
slcp(occ)
swing low close price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
shp(occ)
swing high price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
slp(occ)
swing low price, condition occurrence n
Parameters:
occ (simple int)
Returns: float
shpbi(occ)
swing high price bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
slpbi(occ)
swing low price bar index, condition occurrence n
Parameters:
occ (simple int)
Returns: int
shrr(occ)
swing high range ratio, condition occurrence n
Parameters:
occ (simple int)
Returns: float
slrr(occ)
swing low range ratio, condition occurrence n
Parameters:
occ (simple int)
Returns: float
PubLibCandleTrendLibrary "PubLibCandleTrend"
candle trend, multi-part candle trend, multi-part green/red candle trend, double candle trend and multi-part double candle trend conditions for indicator and strategy development
chh()
candle higher high condition
Returns: bool
chl()
candle higher low condition
Returns: bool
clh()
candle lower high condition
Returns: bool
cll()
candle lower low condition
Returns: bool
cdt()
candle double top condition
Returns: bool
cdb()
candle double bottom condition
Returns: bool
gc()
green candle condition
Returns: bool
gchh()
green candle higher high condition
Returns: bool
gchl()
green candle higher low condition
Returns: bool
gclh()
green candle lower high condition
Returns: bool
gcll()
green candle lower low condition
Returns: bool
gcdt()
green candle double top condition
Returns: bool
gcdb()
green candle double bottom condition
Returns: bool
rc()
red candle condition
Returns: bool
rchh()
red candle higher high condition
Returns: bool
rchl()
red candle higher low condition
Returns: bool
rclh()
red candle lower high condition
Returns: bool
rcll()
red candle lower low condition
Returns: bool
rcdt()
red candle double top condition
Returns: bool
rcdb()
red candle double bottom condition
Returns: bool
chh_1p()
1-part candle higher high condition
Returns: bool
chh_2p()
2-part candle higher high condition
Returns: bool
chh_3p()
3-part candle higher high condition
Returns: bool
chh_4p()
4-part candle higher high condition
Returns: bool
chh_5p()
5-part candle higher high condition
Returns: bool
chh_6p()
6-part candle higher high condition
Returns: bool
chh_7p()
7-part candle higher high condition
Returns: bool
chh_8p()
8-part candle higher high condition
Returns: bool
chh_9p()
9-part candle higher high condition
Returns: bool
chh_10p()
10-part candle higher high condition
Returns: bool
chh_11p()
11-part candle higher high condition
Returns: bool
chh_12p()
12-part candle higher high condition
Returns: bool
chh_13p()
13-part candle higher high condition
Returns: bool
chh_14p()
14-part candle higher high condition
Returns: bool
chh_15p()
15-part candle higher high condition
Returns: bool
chh_16p()
16-part candle higher high condition
Returns: bool
chh_17p()
17-part candle higher high condition
Returns: bool
chh_18p()
18-part candle higher high condition
Returns: bool
chh_19p()
19-part candle higher high condition
Returns: bool
chh_20p()
20-part candle higher high condition
Returns: bool
chh_21p()
21-part candle higher high condition
Returns: bool
chh_22p()
22-part candle higher high condition
Returns: bool
chh_23p()
23-part candle higher high condition
Returns: bool
chh_24p()
24-part candle higher high condition
Returns: bool
chh_25p()
25-part candle higher high condition
Returns: bool
chh_26p()
26-part candle higher high condition
Returns: bool
chh_27p()
27-part candle higher high condition
Returns: bool
chh_28p()
28-part candle higher high condition
Returns: bool
chh_29p()
29-part candle higher high condition
Returns: bool
chh_30p()
30-part candle higher high condition
Returns: bool
chl_1p()
1-part candle higher low condition
Returns: bool
chl_2p()
2-part candle higher low condition
Returns: bool
chl_3p()
3-part candle higher low condition
Returns: bool
chl_4p()
4-part candle higher low condition
Returns: bool
chl_5p()
5-part candle higher low condition
Returns: bool
chl_6p()
6-part candle higher low condition
Returns: bool
chl_7p()
7-part candle higher low condition
Returns: bool
chl_8p()
8-part candle higher low condition
Returns: bool
chl_9p()
9-part candle higher low condition
Returns: bool
chl_10p()
10-part candle higher low condition
Returns: bool
chl_11p()
11-part candle higher low condition
Returns: bool
chl_12p()
12-part candle higher low condition
Returns: bool
chl_13p()
13-part candle higher low condition
Returns: bool
chl_14p()
14-part candle higher low condition
Returns: bool
chl_15p()
15-part candle higher low condition
Returns: bool
chl_16p()
16-part candle higher low condition
Returns: bool
chl_17p()
17-part candle higher low condition
Returns: bool
chl_18p()
18-part candle higher low condition
Returns: bool
chl_19p()
19-part candle higher low condition
Returns: bool
chl_20p()
20-part candle higher low condition
Returns: bool
chl_21p()
21-part candle higher low condition
Returns: bool
chl_22p()
22-part candle higher low condition
Returns: bool
chl_23p()
23-part candle higher low condition
Returns: bool
chl_24p()
24-part candle higher low condition
Returns: bool
chl_25p()
25-part candle higher low condition
Returns: bool
chl_26p()
26-part candle higher low condition
Returns: bool
chl_27p()
27-part candle higher low condition
Returns: bool
chl_28p()
28-part candle higher low condition
Returns: bool
chl_29p()
29-part candle higher low condition
Returns: bool
chl_30p()
30-part candle higher low condition
Returns: bool
clh_1p()
1-part candle lower high condition
Returns: bool
clh_2p()
2-part candle lower high condition
Returns: bool
clh_3p()
3-part candle lower high condition
Returns: bool
clh_4p()
4-part candle lower high condition
Returns: bool
clh_5p()
5-part candle lower high condition
Returns: bool
clh_6p()
6-part candle lower high condition
Returns: bool
clh_7p()
7-part candle lower high condition
Returns: bool
clh_8p()
8-part candle lower high condition
Returns: bool
clh_9p()
9-part candle lower high condition
Returns: bool
clh_10p()
10-part candle lower high condition
Returns: bool
clh_11p()
11-part candle lower high condition
Returns: bool
clh_12p()
12-part candle lower high condition
Returns: bool
clh_13p()
13-part candle lower high condition
Returns: bool
clh_14p()
14-part candle lower high condition
Returns: bool
clh_15p()
15-part candle lower high condition
Returns: bool
clh_16p()
16-part candle lower high condition
Returns: bool
clh_17p()
17-part candle lower high condition
Returns: bool
clh_18p()
18-part candle lower high condition
Returns: bool
clh_19p()
19-part candle lower high condition
Returns: bool
clh_20p()
20-part candle lower high condition
Returns: bool
clh_21p()
21-part candle lower high condition
Returns: bool
clh_22p()
22-part candle lower high condition
Returns: bool
clh_23p()
23-part candle lower high condition
Returns: bool
clh_24p()
24-part candle lower high condition
Returns: bool
clh_25p()
25-part candle lower high condition
Returns: bool
clh_26p()
26-part candle lower high condition
Returns: bool
clh_27p()
27-part candle lower high condition
Returns: bool
clh_28p()
28-part candle lower high condition
Returns: bool
clh_29p()
29-part candle lower high condition
Returns: bool
clh_30p()
30-part candle lower high condition
Returns: bool
cll_1p()
1-part candle lower low condition
Returns: bool
cll_2p()
2-part candle lower low condition
Returns: bool
cll_3p()
3-part candle lower low condition
Returns: bool
cll_4p()
4-part candle lower low condition
Returns: bool
cll_5p()
5-part candle lower low condition
Returns: bool
cll_6p()
6-part candle lower low condition
Returns: bool
cll_7p()
7-part candle lower low condition
Returns: bool
cll_8p()
8-part candle lower low condition
Returns: bool
cll_9p()
9-part candle lower low condition
Returns: bool
cll_10p()
10-part candle lower low condition
Returns: bool
cll_11p()
11-part candle lower low condition
Returns: bool
cll_12p()
12-part candle lower low condition
Returns: bool
cll_13p()
13-part candle lower low condition
Returns: bool
cll_14p()
14-part candle lower low condition
Returns: bool
cll_15p()
15-part candle lower low condition
Returns: bool
cll_16p()
16-part candle lower low condition
Returns: bool
cll_17p()
17-part candle lower low condition
Returns: bool
cll_18p()
18-part candle lower low condition
Returns: bool
cll_19p()
19-part candle lower low condition
Returns: bool
cll_20p()
20-part candle lower low condition
Returns: bool
cll_21p()
21-part candle lower low condition
Returns: bool
cll_22p()
22-part candle lower low condition
Returns: bool
cll_23p()
23-part candle lower low condition
Returns: bool
cll_24p()
24-part candle lower low condition
Returns: bool
cll_25p()
25-part candle lower low condition
Returns: bool
cll_26p()
26-part candle lower low condition
Returns: bool
cll_27p()
27-part candle lower low condition
Returns: bool
cll_28p()
28-part candle lower low condition
Returns: bool
cll_29p()
29-part candle lower low condition
Returns: bool
cll_30p()
30-part candle lower low condition
Returns: bool
gc_1p()
1-part green candle condition
Returns: bool
gc_2p()
2-part green candle condition
Returns: bool
gc_3p()
3-part green candle condition
Returns: bool
gc_4p()
4-part green candle condition
Returns: bool
gc_5p()
5-part green candle condition
Returns: bool
gc_6p()
6-part green candle condition
Returns: bool
gc_7p()
7-part green candle condition
Returns: bool
gc_8p()
8-part green candle condition
Returns: bool
gc_9p()
9-part green candle condition
Returns: bool
gc_10p()
10-part green candle condition
Returns: bool
gc_11p()
11-part green candle condition
Returns: bool
gc_12p()
12-part green candle condition
Returns: bool
gc_13p()
13-part green candle condition
Returns: bool
gc_14p()
14-part green candle condition
Returns: bool
gc_15p()
15-part green candle condition
Returns: bool
gc_16p()
16-part green candle condition
Returns: bool
gc_17p()
17-part green candle condition
Returns: bool
gc_18p()
18-part green candle condition
Returns: bool
gc_19p()
19-part green candle condition
Returns: bool
gc_20p()
20-part green candle condition
Returns: bool
gc_21p()
21-part green candle condition
Returns: bool
gc_22p()
22-part green candle condition
Returns: bool
gc_23p()
23-part green candle condition
Returns: bool
gc_24p()
24-part green candle condition
Returns: bool
gc_25p()
25-part green candle condition
Returns: bool
gc_26p()
26-part green candle condition
Returns: bool
gc_27p()
27-part green candle condition
Returns: bool
gc_28p()
28-part green candle condition
Returns: bool
gc_29p()
29-part green candle condition
Returns: bool
gc_30p()
30-part green candle condition
Returns: bool
rc_1p()
1-part red candle condition
Returns: bool
rc_2p()
2-part red candle condition
Returns: bool
rc_3p()
3-part red candle condition
Returns: bool
rc_4p()
4-part red candle condition
Returns: bool
rc_5p()
5-part red candle condition
Returns: bool
rc_6p()
6-part red candle condition
Returns: bool
rc_7p()
7-part red candle condition
Returns: bool
rc_8p()
8-part red candle condition
Returns: bool
rc_9p()
9-part red candle condition
Returns: bool
rc_10p()
10-part red candle condition
Returns: bool
rc_11p()
11-part red candle condition
Returns: bool
rc_12p()
12-part red candle condition
Returns: bool
rc_13p()
13-part red candle condition
Returns: bool
rc_14p()
14-part red candle condition
Returns: bool
rc_15p()
15-part red candle condition
Returns: bool
rc_16p()
16-part red candle condition
Returns: bool
rc_17p()
17-part red candle condition
Returns: bool
rc_18p()
18-part red candle condition
Returns: bool
rc_19p()
19-part red candle condition
Returns: bool
rc_20p()
20-part red candle condition
Returns: bool
rc_21p()
21-part red candle condition
Returns: bool
rc_22p()
22-part red candle condition
Returns: bool
rc_23p()
23-part red candle condition
Returns: bool
rc_24p()
24-part red candle condition
Returns: bool
rc_25p()
25-part red candle condition
Returns: bool
rc_26p()
26-part red candle condition
Returns: bool
rc_27p()
27-part red candle condition
Returns: bool
rc_28p()
28-part red candle condition
Returns: bool
rc_29p()
29-part red candle condition
Returns: bool
rc_30p()
30-part red candle condition
Returns: bool
cdut()
candle double uptrend condition
Returns: bool
cddt()
candle double downtrend condition
Returns: bool
cdut_1p()
1-part candle double uptrend condition
Returns: bool
cdut_2p()
2-part candle double uptrend condition
Returns: bool
cdut_3p()
3-part candle double uptrend condition
Returns: bool
cdut_4p()
4-part candle double uptrend condition
Returns: bool
cdut_5p()
5-part candle double uptrend condition
Returns: bool
cdut_6p()
6-part candle double uptrend condition
Returns: bool
cdut_7p()
7-part candle double uptrend condition
Returns: bool
cdut_8p()
8-part candle double uptrend condition
Returns: bool
cdut_9p()
9-part candle double uptrend condition
Returns: bool
cdut_10p()
10-part candle double uptrend condition
Returns: bool
cdut_11p()
11-part candle double uptrend condition
Returns: bool
cdut_12p()
12-part candle double uptrend condition
Returns: bool
cdut_13p()
13-part candle double uptrend condition
Returns: bool
cdut_14p()
14-part candle double uptrend condition
Returns: bool
cdut_15p()
15-part candle double uptrend condition
Returns: bool
cdut_16p()
16-part candle double uptrend condition
Returns: bool
cdut_17p()
17-part candle double uptrend condition
Returns: bool
cdut_18p()
18-part candle double uptrend condition
Returns: bool
cdut_19p()
19-part candle double uptrend condition
Returns: bool
cdut_20p()
20-part candle double uptrend condition
Returns: bool
cdut_21p()
21-part candle double uptrend condition
Returns: bool
cdut_22p()
22-part candle double uptrend condition
Returns: bool
cdut_23p()
23-part candle double uptrend condition
Returns: bool
cdut_24p()
24-part candle double uptrend condition
Returns: bool
cdut_25p()
25-part candle double uptrend condition
Returns: bool
cdut_26p()
26-part candle double uptrend condition
Returns: bool
cdut_27p()
27-part candle double uptrend condition
Returns: bool
cdut_28p()
28-part candle double uptrend condition
Returns: bool
cdut_29p()
29-part candle double uptrend condition
Returns: bool
cdut_30p()
30-part candle double uptrend condition
Returns: bool
cddt_1p()
1-part candle double downtrend condition
Returns: bool
cddt_2p()
2-part candle double downtrend condition
Returns: bool
cddt_3p()
3-part candle double downtrend condition
Returns: bool
cddt_4p()
4-part candle double downtrend condition
Returns: bool
cddt_5p()
5-part candle double downtrend condition
Returns: bool
cddt_6p()
6-part candle double downtrend condition
Returns: bool
cddt_7p()
7-part candle double downtrend condition
Returns: bool
cddt_8p()
8-part candle double downtrend condition
Returns: bool
cddt_9p()
9-part candle double downtrend condition
Returns: bool
cddt_10p()
10-part candle double downtrend condition
Returns: bool
cddt_11p()
11-part candle double downtrend condition
Returns: bool
cddt_12p()
12-part candle double downtrend condition
Returns: bool
cddt_13p()
13-part candle double downtrend condition
Returns: bool
cddt_14p()
14-part candle double downtrend condition
Returns: bool
cddt_15p()
15-part candle double downtrend condition
Returns: bool
cddt_16p()
16-part candle double downtrend condition
Returns: bool
cddt_17p()
17-part candle double downtrend condition
Returns: bool
cddt_18p()
18-part candle double downtrend condition
Returns: bool
cddt_19p()
19-part candle double downtrend condition
Returns: bool
cddt_20p()
20-part candle double downtrend condition
Returns: bool
cddt_21p()
21-part candle double downtrend condition
Returns: bool
cddt_22p()
22-part candle double downtrend condition
Returns: bool
cddt_23p()
23-part candle double downtrend condition
Returns: bool
cddt_24p()
24-part candle double downtrend condition
Returns: bool
cddt_25p()
25-part candle double downtrend condition
Returns: bool
cddt_26p()
26-part candle double downtrend condition
Returns: bool
cddt_27p()
27-part candle double downtrend condition
Returns: bool
cddt_28p()
28-part candle double downtrend condition
Returns: bool
cddt_29p()
29-part candle double downtrend condition
Returns: bool
cddt_30p()
30-part candle double downtrend condition
Returns: bool
Adaptive RSI BandsThe RSI Band Optimizer is an innovative technical analysis tool designed to identify and display the most effective Relative Strength Index (RSI) band values for any given trading instrument. This powerful indicator dynamically calculates optimal overbought and oversold levels, moving beyond the traditional static 70/30 or 80/20 bands.
Core Functionality:
Dynamic RSI Band Calculation:
The indicator analyzes historical price data to determine the most effective RSI levels for identifying overbought and oversold conditions specific to the current trading instrument and timeframe.
Adaptive Optimization:
Rather than relying on external factors, the tool uses a proprietary algorithm that focuses solely on the relationship between historical RSI values and subsequent price movements. This pure RSI-based approach ensures that the bands are optimized for the indicator's own dynamics.
Continuous Recalibration:
The optimal RSI bands are continuously recalculated as new price data becomes available, ensuring that the indicator adapts to changing market conditions and remains relevant over time.
Key Inputs:
RSI Length:
Allows users to set the period for the RSI calculation. While the default is typically 14, users can adjust this to suit their trading style and the characteristics of the instrument they're trading.
Optimization Lookback:
Defines the historical period the indicator uses to calculate optimal bands. This balance between recent market behavior and longer-term patterns.
Band Sensitivity:
Enables fine-tuning of how aggressively the indicator adjusts the RSI bands. Higher sensitivity results in more frequent band adjustments, while lower sensitivity provides more stable levels.
What Makes It Unique:
Self-Contained Optimization:
Unlike indicators that rely on external data sources or comparisons, this tool focuses purely on optimizing RSI bands based on the indicator's own historical performance.
Instrument-Specific Bands:
By calculating optimal bands for each specific instrument, the indicator acknowledges that different assets may have different typical RSI ranges and behaviors.
Timeframe Adaptability:
The optimization process adapts to the selected timeframe, recognizing that optimal RSI bands may differ between short-term and long-term charts.
Dynamic Band Adjustment:
The continuous recalibration of bands allows the indicator to adapt to changing market volatility and trends, providing more relevant signals over time.
Enhanced RSI Interpretation:
By providing optimized, asset-specific overbought and oversold levels, the indicator offers a more nuanced and potentially more accurate interpretation of RSI values.
The RSI Band Optimizer represents a significant advancement in the application of the Relative Strength Index. By dynamically calculating optimal band values, it addresses one of the main criticisms of traditional RSI usage – the reliance on static, one-size-fits-all overbought and oversold levels. This tool empowers traders to make more informed decisions based on RSI readings that are truly tailored to the specific characteristics of the asset they're trading.
1000SATS and ORDI Market Cap RatioSure! Here is a detailed description and usage guide for your TradingView indicator:
### Indicator Description
**Title**: 1000SATS/ORDI Market Cap Ratio
**Description**: The "1000SATS/ORDI Market Cap Ratio" indicator calculates and visualizes the market capitalization ratio between 1000SATS and ORDI. This indicator allows traders and investors to analyze the relative market strength and valuation trends of 1000SATS compared to ORDI over time. By tracking this ratio, users can gain insights into market dynamics and potential trading opportunities between these two assets.
### Indicator Usage
**Purpose**:
- To compare the market capitalizations of 1000SATS and ORDI.
- To identify potential undervaluation or overvaluation of 1000SATS relative to ORDI.
- To assist in making informed trading and investment decisions based on market cap trends.
**How to Use**:
1. **Add the Indicator to Your Chart**:
- Open TradingView and navigate to your chart.
- Click on the "Indicators" button at the top of the chart.
- Select "Pine Editor" and paste the provided script.
- Click "Add to Chart" to apply the indicator.
2. **Interpret the Ratio**:
- The indicator will plot a line representing the ratio of the market capitalization of 1000SATS to ORDI.
- A rising ratio indicates that the market cap of 1000SATS is increasing relative to ORDI, suggesting stronger market performance or higher valuation of 1000SATS.
- A falling ratio indicates that the market cap of 1000SATS is decreasing relative to ORDI, suggesting weaker market performance or lower valuation of 1000SATS.
3. **Analyze Trends**:
- Use the indicator to spot trends and potential reversal points in the market cap ratio.
- Combine the ratio analysis with other technical indicators and chart patterns to enhance your trading strategy.
4. **Set Alerts**:
- Set custom alerts on the ratio to notify you of significant changes or specific thresholds being reached, enabling timely decision-making.
**Example**:
- If the ratio is consistently rising, it may indicate a good opportunity to consider 1000SATS as a stronger investment relative to ORDI.
- Conversely, if the ratio is falling, it may be a signal to reevaluate the strength of 1000SATS compared to ORDI.
**Note**: Always conduct thorough analysis and consider other market factors before making trading decisions based on this indicator.
### Script
```pinescript
//@version=4
study("1000SATS and ORDI Market Cap Ratio", shorttitle="1000SATS/ORDI Ratio", overlay=true)
// Define the circulating supply for ORDI and 1000SATS
ORDI_supply = 21000000 // Circulating supply of ORDI
SATS_1000_supply = 2100000000000 // Circulating supply of 1000SATS
// Fetch the price data for ORDI
ordi_price = security("BINANCE:ORDIUSDT", timeframe.period, close)
// Fetch the price data for 1000SATS
sats_1000_price = security("BINANCE:1000SATSUSDT", timeframe.period, close)
// Calculate the market capitalizations
ordi_market_cap = ordi_price * ORDI_supply
sats_1000_market_cap = sats_1000_price * SATS_1000_supply
// Calculate the market cap ratio
ratio = sats_1000_market_cap / ordi_market_cap
// Plot the ratio
plot(ratio, title="1000SATS/ORDI Market Cap Ratio", color=color.blue, linewidth=2)
```
This description and usage guide should help users understand the purpose and functionality of your indicator, as well as how to effectively apply it in their trading activities on TradingView.
Ethereum ETF Tracker (EET)Get all the information you need about all the different Ethereum ETF.
With the Ethereum ETF Tracker, you can observe all possible Ethereum ETF data:
ETF name.
Ticker.
Price.
Volume.
Share of total ETF volume.
Fees.
Exchange.
Custodian.
At the bottom of the table, you'll find the ETHE Premium (and ETH per Share), and day's total volume.
In addition, you can see the volume for the different Exchanges, as well as for the different Custodians.
If you don't want to display these lines to save space, you can uncheck "Show Additional Data" in the indicator settings.
The Idea
The goal is to provide the community with a tool for tracking all Ethereum ETF data in a synthesized way, directly in your TradingView chart.
How to Use
Simply read the information in the table. You can hover above the Fees and Exchanges cells for more details.
The table takes space on the chart, you can remove the extra lines by unchecking "Show Additional Data" in the indicator settings or reduce text size by changing the "Table Text Size" parameter.
Aggregate volume can be displayed directly on the graph (this volume can be displayed on any asset, such as Ethereum itself). The display can be disabled in the settings.
Coinbase vs Binance Spot Premium for All coins🔶 Coinbase Premium
This indicator allows you to track the premiums for various coins listed on Coinbase relative to Binance. The buying strength of US markets tend to be a good indicator for up trending markets.
The moving average crosses shown as ribbons can be used to time entries and exits
🔶 Available Pairs
Currently, the indicator includes 31 coins as listed below:
BTC, ETH, SOL, BONK, DOGE, XRP, SHIB, ONDO, AVAX, LINK, ENS, LTC, RNDR, INJ, BCH, ARB, OP, ADA, DOT, TIA, ICP, MATIC, LDO, NEAR, CVX, AERO, ORCA, SEI, STX, MKR, SUI
🔶 Key Features
Select Coin: You can select any of the 31 supported coins to track its premium.
Show Ribbons: Option to enable or disable the display of ribbon trend lines between two moving averages.
Adjust MA Lengths: Customizable lengths for the short and long moving averages to fine-tune the trend analysis.
🔶 Calculations
The premium is a simple nominal difference between the Coinbase price and the Binance price.
eg) Coinbase ETHUSD - Binance ETHUSDT = Premium
🔶 Disclaimer
This indicator is for informational purposes only and should not be considered financial advice.
Always conduct your own research and due diligence before making any trading decisions. Past performance is not necessarily indicative of future results.
[SGM Markov Chain]Introduction
A Markov chain is a mathematical model that describes a system evolving over time among a finite number of states. This model is based on the assumption that the future state of the system depends only on the current state and not on previous states, the so-called Markov property. In the context of financial markets, Markov chains can be used to model transitions between different market conditions, for example, the probability of a price going up after going up, or going down after going down.
Script Description
This script uses a Markov chain to calculate closing price transition probabilities across the entire accessible chart. It displays the probabilities of the following transitions:
- Up after Up (HH): Probability that the price rises after going up.
- Down after Down (BB): Probability that the price will go down after going down.
- Up after Down (HB): Probability that the price goes up after going down.
- Down after Up (BH): Probability that the price will go down after going up.
Features
- Color customization: Choose colors for each transition type.
- Table Position: Select the position of the probability display table (top/left, top/right, bottom/left, bottom/right).
Position Size CalculatorThe Position Size Calculator (PSC) is a comprehensive tool designed to assist traders in managing their trades risk by accurately calculating the optimal position size based on account settings, trade levels, and risk management parameters. This indicator helps traders make informed decisions by providing critical information about potential profit and loss , risk-reward ratio (RRR) , and position size (PS) .
█ Key Features
• Customizable Account Settings: Define your account size , currency , risk tolerance , and commission structure to personalize the calculations.
• Real-Time Trade Levels: Easily input your entry , stop loss , and take profit prices directly on the chart for immediate calculations.
• Visual Indicators: Clearly see your entry, stop loss, and take profit levels with customizable colors and labels.
• Comprehensive Position Information: View detailed information about your position, including potential profit and loss , risk-reward ratio , and position size .
• Currency Conversion: Automatically convert prices to your account currency, making it easy to manage trades in different markets.
• Hide Metrics : Choose which metrics to display to avoid emotional influence on your trading decisions (e.g., hiding PnL).
█ Conclusion
The Position Size Calculator is an essential tool for traders looking to optimize their trading strategies and manage risk effectively . By providing detailed calculations and visual indicators, this tool helps you make informed decisions, improving your overall trading performance.
█ Important
• Ensure that your stop loss and take profit levels are correctly set relative to your entry price to avoid errors.
• The default commission setting considers both entry and exit commissions. Adjust accordingly if only one commission is applicable.
Consider using this tool to manage every trade risk correctly and prevent significant drawdowns.
Hope you like it. Happy trading!
GG Short & Long IndicatorGG Short & Long Indicator is a powerful signal indicator with AI
How do indicator signals work?
The main purpose of the indicator is to give a signal that is most likely to bring profit based on historical data. This ORIGINAL trend algorithm gives SHORT and LONG signals when several conditions coincide: 1) Breakout of the average value of the modernized VWAP (this VWAP takes data only from certain time periods and trading sessions, as a result, its breakout most often coincides with the beginning of a strong trend); 2) The previous condition must be confirmed by volumes. I noticed that on some crypto exchanges, depending on whether the breakout is false or true, the volumes are different relative to each other. I applied this knowledge for additional filtering of signals (this point works only on crypto assets, on other assets the algorithm works without taking it into account, maybe later I will refine it); 3) When some of my original formulas to determine overbought (similar in principle to RSI, but more designed to work with the trader algorithm), should not show overbought - so that the entry into the transaction was not at too unfavorable values. To summarize, the algorithm tries to find a balance to determine a true breakout, during which the price will not go too far (for an acceptable RR).
But the most important thing is that the parameters to customize the algorithm are governed by our original AI algorithm. It can adjust the indicator in two modes: 1) Settings are selected based on the most profitable historical settings. 2) The settings are selected based not only on historical profitability, but also on winrate, frequency of trades, and a few other items that we will not disclose (so the code is closed) - we consider this approach as a priority, because according to our observations, it gives the highest performance compared to manual tuning. In addition, AI simply simplifies the work with the indicator - you do not need to adjust the settings manually for different trading pairs or timeframes, AI will do it all by itself and immediately give the ready result (backtest) on the table.
How to trade?
After the signal is issued, the indicator determines the recommended levels to close the trade (green dots). Stop loss should be placed behind the corresponding gray SL mark. Levels for closing a deal (TP) and the level of stop loss setting (SL) are also determined automatically for the selected pair and TF, based on volatility and selected indicator settings
To make a trade, you can also use the built-in “Support and Resistance Zones” tool, which displays ranges on the chart based on the modernized ATR, from which the price is more likely to rebound (here I also used my own approach, where in addition to the classic ATR formula, I also used volumes from certain crypto exchanges to determine more accurate price rebound zones)
These zones are also adjusted by AI - the algorithm compares several dozens of variations of these zones (with different settings) and chooses the one that best fits the current settings of the signal algorithm. For example, if the indicator is set up for frequent trades - the zones will be updated faster and will be less deep than if the indicator is set up for medium-term trading
If desired, you can customize the indicator manually using the corresponding section of the settings. Each paramater has a tooltip describing how and what it affects.
Statistisc panel
The panel can be divided into 2 conditional parts:
1) Statistics for each individual TP for the selected strategy. It shows the winrate and gross profit, if you fix a trade on a single target completely
2) Total trading result, if you trade clearly according to the strategy and fix the position by equal hours on 4 TPs. The total trading result is displayed for the current indicator settings, it also shows the best, worst and optimal of the possible indicator settings and the trading result of these settings on the side.
How do setup the indicator?
The indicator has preset settings for several major pairs and timeframes. These are fixed settings specifically selected for individual pairs and timeframes. You can use these presets, or you can choose one of the adaptive settings, which will AUTOMATICALLY select the best/optimal indicator settings.
I recommend choosing the “Adaptive Optimal” preset, as it uses more data to determine the optimal indicator settings and according to my observations this method works better in comparison to manual indicator settings or the “Adaptive Best” preset
Or you can use the manual settings, as mentioned earlier.
[SGM Return Distribution]Code Description
This Pine Script™ is designed to analyze the distribution of historical returns of a financial asset and project future confidence levels. It uses statistical techniques to estimate the probability of winning and losing as well as displaying confidence bands and distribution statistics.
User Entries
Length (252): The number of days used to calculate statistics.
Offset (20): Offset used to project future values.
Projection Days (10): Number of days projected into the future.
Smoothing Confidence Levels (10): Smoothing confidence bands.
Display Settings
Plot Distribution: Shows the distribution of returns.
Show Probabilities: Shows winning and losing probabilities.
Show Distribution Stats: Shows distribution statistics.
Show Confidence Bands: Shows confidence bands.
Show Confidence Lines: Shows confidence lines.
Calculations and Features
Distribution of Yields:
Calculates logarithmic returns and their statistics (average, volatility, skewness, kurtosis).
Projects the average and volatility over the projected number of days.
Displays the distribution of returns as a histogram.
Confidence Interval:
Uses the inv_norm function to calculate Z scores for different confidence levels.
Calculates the upper and lower bounds of the confidence bands.
Probability Display:
Calculates and displays win and loss probabilities based on the distribution of returns.
Statistics Display:
Shows key statistics such as mean, volatility, skewness and kurtosis.
Trust Bands and Lines:
Shows confidence bands and lines based on calculated confidence levels.
Mathematical Assumptions Used
Logarithmic Returns: Returns are calculated using the logarithm of prices, which is common for financial time series because it makes returns independent of price level.
Normal Distribution for Confidence Bands: Confidence interval calculations are based on the assumption that returns follow a normal distribution.
Average and Volatility Projection: Average returns and volatility are projected over a future period assuming they remain constant.
Skewness and Kurtosis: Although these measures are calculated for understanding the distribution of returns, they are not used in box projections but can provide additional information about the distribution of historical returns.
Use in Trading
Risk Estimation: Confidence bands can help estimate likely future price levels, which is crucial for determining strike levels and risk management.
Risk Management: Use confidence bands to set stop-loss and take-profit levels.
Probability Analysis: Win and loss probabilities can help assess a position's likelihood of success.
Potential Problems
Assumption of Normality for Confidence Bands: Financial returns do not always follow a normal distribution, especially in the presence of extreme events (fat tails).
Stationarity: Assuming that return statistics (average, volatility) remain constant over time can be erroneous in volatile market periods.
Limited Historical Data: Using a limited history (252 days) may not capture all possible behaviors of the asset.
Input Parameters: Results can be sensitive to the input parameters chosen (length, offset, etc.).
Harmonic Patterns Library [TradingFinder]🔵 Introduction
Harmonic patterns blend geometric shapes with Fibonacci numbers, making these numbers fundamental to understanding the patterns.
One person who has done a lot of research on harmonic patterns is Scott Carney.Scott Carney's research on harmonic patterns in technical analysis focuses on precise price structures based on Fibonacci ratios to identify market reversals.
Key patterns include the Gartley, Bat, Butterfly, and Crab, each with specific alignment criteria. These patterns help traders anticipate potential market turning points and make informed trading decisions, enhancing the predictability of technical analysis.
🟣 Understanding 5-Point Harmonic Patterns
In the current library version, you can easily draw and customize most XABCD patterns. These patterns often form M or W shapes, or a combination of both. By calculating the Fibonacci ratios between key points, you can estimate potential price movements.
All five-point patterns share a similar structure, differing only in line lengths and Fibonacci ratios. Learning one pattern simplifies understanding others.
🟣 Exploring the Gartley Pattern
The Gartley pattern appears in both bullish (M shape) and bearish (W shape) forms. In the bullish Gartley, point X is below point D, and point A surpasses point C. Point D marks the start of a strong upward trend, making it an optimal point to place a buy order.
The bearish Gartley mirrors the bullish pattern with inverted Fibonacci ratios. In this scenario, point D indicates the start of a significant price drop. Traders can place sell orders at this point and buy at lower prices for profit in two-way markets.
🟣 Analyzing the Butterfly Pattern
The Butterfly pattern also manifests in bullish (M shape) and bearish (W shape) forms. It resembles the Gartley pattern but with point D lower than point X in the bullish version.
The Butterfly pattern involves deeper price corrections than the Gartley, leading to more significant price fluctuations. Point D in the bullish Butterfly indicates the beginning of a sharp price rise, making it an entry point for buy orders.
The bearish Butterfly has inverted Fibonacci ratios, with point D marking the start of a sharp price decline, ideal for sell orders followed by buying at lower prices in two-way markets.
🟣 Insights into the Bat Pattern
The Bat pattern, appearing in bullish (M shape) and bearish (W shape) forms, is one of the most precise harmonic patterns. It closely resembles the Butterfly and Gartley patterns, differing mainly in Fibonacci levels.
The bearish Bat pattern shares the Fibonacci ratios with the bullish Bat, with an inverted structure. Point D in the bearish Bat marks the start of a significant price drop, suitable for sell orders followed by buying at lower prices for profit.
🟣 The Crab Pattern Explained
The Crab pattern, found in both bullish (M shape) and bearish (W shape) forms, is highly favored by analysts. Discovered in 2000, the Crab pattern features a larger final wave correction compared to other harmonic patterns.
The bearish Crab shares Fibonacci ratios with the bullish version but in an inverted form. Point D in the bearish Crab signifies the start of a sharp price decline, making it an ideal point for sell orders followed by buying at lower prices for profitable trades.
🟣 Understanding the Shark Pattern
The Shark pattern appears in bullish (M shape) and bearish (W shape) forms. It differs from previous patterns as point C in the bullish Shark surpasses point A, with unique level measurements.
The bearish Shark pattern mirrors the Fibonacci ratios of the bullish Shark but is inverted. Point D in the bearish Shark indicates the start of a sharp price drop, ideal for placing sell orders and buying at lower prices to capitalize on the pattern.
🟣 The Cypher Pattern Overview
The Cypher pattern is another that appears in both bullish (M shape) and bearish (W shape) forms. It resembles the Shark pattern, with point C in the bullish Cypher extending beyond point A, and point D forming within the XA line.
The bearish Cypher shares the Fibonacci ratios with the bullish Cypher but in an inverted structure. Point D in the bearish Cypher marks the start of a significant price drop, perfect for sell orders followed by buying at lower prices.
🟣 Introducing the Nen-Star Pattern
The Nen-Star pattern appears in both bullish (M shape) and bearish (W shape) forms. In the bullish Nen-Star, point C extends beyond point A, and point D, the final point, forms outside the XA line, making CD the longest wave.
The bearish Nen-Star has inverted Fibonacci ratios, with point D indicating the start of a significant price drop. Traders can place sell orders at point D and buy at lower prices to profit from this pattern in two-way markets.
The 5-point harmonic patterns, commonly referred to as XABCD patterns, are specific geometric price structures identified in financial markets. These patterns are used by traders to predict potential price movements based on historical price data and Fibonacci retracement levels.
Here are the main 5-point harmonic patterns :
Gartley Pattern
Anti-Gartley Pattern
Bat Pattern
Anti-Bat Pattern
Alternate Bat Pattern
Butterfly Pattern
Anti-Butterfly Pattern
Crab Pattern
Anti-Crab Pattern
Deep Crab Pattern
Shark Pattern
Anti- Shark Pattern
Anti Alternate Shark Pattern
Cypher Pattern
Anti-Cypher Pattern
🔵 How to Use
To add "Order Block Refiner Library", you must first add the following code to your script.
import TFlab/Harmonic_Chart_Pattern_Library_TradingFinder/1 as HP
🟣 Parameters
XABCD(Name, Type, Show, Color, LineWidth, LabelSize, ShVF, FLPC, FLPCPeriod, Pivot, ABXAmin, ABXAmax, BCABmin, BCABmax, CDBCmin, CDBCmax, CDXAmin, CDXAmax) =>
Parameters:
Name (string)
Type (string)
Show (bool)
Color (color)
LineWidth (int)
LabelSize (string)
ShVF (bool)
FLPC (bool)
FLPCPeriod (int)
Pivot (int)
ABXAmin (float)
ABXAmax (float)
BCABmin (float)
BCABmax (float)
CDBCmin (float)
CDBCmax (float)
CDXAmin (float)
CDXAmax (float)
🟣 Genaral Parameters
Name : The name of the pattern.
Type: Enter "Bullish" to draw a Bullish pattern and "Bearish" to draw an Bearish pattern.
Show : Enter "true" to display the template and "false" to not display the template.
Color : Enter the desired color to draw the pattern in this parameter.
LineWidth : You can enter the number 1 or numbers higher than one to adjust the thickness of the drawing lines. This number must be an integer and increases with increasing thickness.
LabelSize : You can adjust the size of the labels by using the "size.auto", "size.tiny", "size.smal", "size.normal", "size.large" or "size.huge" entries.
🟣 Logical Parameters
ShVF : If this parameter is on "true" mode, only patterns will be displayed that they have exact format and no noise can be seen in them. If "false" is, the patterns displayed that maybe are noisy and do not exactly correspond to the original pattern.
FLPC : if Turned on, you can see this ability of patterns when their last pivot is formed. If this feature is off, it will see the patterns as soon as they are formed. The advantage of this option being clear is less formation of fielded patterns, and it is accompanied by the lateest pattern seeing and a sharp reduction in reward to risk.
FLPCPeriod : Using this parameter you can determine that the last pivot is based on Pivot period.
Pivot : You need to determine the period of the zigzag indicator. This factor is the most important parameter in pattern recognition.
ABXAmin : Minimum retracement of "AB" line compared to "XA" line.
ABXAmax : Maximum retracement of "AB" line compared to "XA" line.
BCABmin : Minimum retracement of "BC" line compared to "AB" line.
BCABmax : Maximum retracement of "BC" line compared to "AB" line.
CDBCmin : Minimum retracement of "CD" line compared to "BC" line.
CDBCmax : Maximum retracement of "CD" line compared to "BC" line.
CDXAmin : Minimum retracement of "CD" line compared to "XA" line.
CDXAmax : Maximum retracement of "CD" line compared to "XA" line.
🟣 Function Outputs
This library has two outputs. The first output is related to the alert of the formation of a new pattern. And the second output is related to the formation of the candlestick pattern and you can draw it using the "plotshape" tool.
Candle Confirmation Logic :
Example :
import TFlab/Harmonic_Chart_Pattern_Library_TradingFinder/1 as HP
PP = input.int(3, 'ZigZag Pivot Period')
ShowBull = input.bool(true, 'Show Bullish Pattern')
ShowBear = input.bool(true, 'Show Bearish Pattern')
ColorBull = input.color(#0609bb, 'Color Bullish Pattern')
ColorBear = input.color(#0609bb, 'Color Bearish Pattern')
LineWidth = input.int(1 , 'Width Line')
LabelSize = input.string(size.small , 'Label size' , options = )
ShVF = input.bool(false , 'Show Valid Format')
FLPC = input.bool(false , 'Show Formation Last Pivot Confirm')
FLPCPeriod =input.int(2, 'Period of Formation Last Pivot')
//Call function
= HP.XABCD('Bullish Bat', 'Bullish', ShowBull, ColorBull , LineWidth, LabelSize ,ShVF, FLPC, FLPCPeriod, PP, 0.382, 0.50, 0.382, 0.886, 1.618, 2.618, 0.85, 0.9)
= HP.XABCD('Bearish Bat', 'Bearish', ShowBear, ColorBear , LineWidth, LabelSize ,ShVF, FLPC, FLPCPeriod, PP, 0.382, 0.50, 0.382, 0.886, 1.618, 2.618, 0.85, 0.9)
//Alert
if BearAlert
alert('Bearish Harmonic')
if BullAlert
alert('Bulish Harmonic')
//CandleStick Confirm
plotshape(BearCandleConfirm, style = shape.arrowdown, color = color.red)
plotshape(BullCandleConfirm, style = shape.arrowup, color = color.green, location = location.belowbar )
Auto Risk Manager
Auto Risk Manager
**Description:**
The "Auto Risk Manager" indicator is designed to assist traders in managing their risk and reward levels efficiently. This indicator is particularly beneficial for traders who want to automate their risk management process, ensuring they adhere to their trading plan without constantly monitoring the charts. It is tailored to help both novice and experienced traders by providing clear visual cues and automated calculations for stop loss and take profit levels.
**Purpose:**
The primary purpose of the Auto Risk Manager is to simplify and automate the process of setting stop loss and take profit levels based on user-defined risk parameters. By leveraging this tool, traders can ensure that they are consistently managing their trades according to their risk tolerance and trading strategy. This indicator helps traders avoid emotional decision-making, which can often lead to suboptimal trading outcomes.
**Functionality:**
The Auto Risk Manager provides the following key features:
1. **Trade Direction:** Allows the trader to specify the direction of the trade (Buy or Sell).
2. **Stop Loss and Take Profit Points:** Users can manually input their desired stop loss and take profit points.
3. **Risk Management:** Traders can enable risk management to automatically calculate stop loss and take profit levels based on their account balance, risk percentage, and desired risk-to-reward ratio.
4. **Visual Representation:** The indicator plots the entry price, stop loss, and take profit levels on the chart, providing a clear visual representation of the trade setup.
5. **Alerts:** The indicator generates alerts when the price hits the stop loss or take profit levels, ensuring that traders are promptly notified of important trade events.
6. **Customization:** Users can customize the appearance of the lines and labels, and choose to show or hide previous points.
**How It Works:**
- **Input Parameters:**
- **Trade Direction:** Select "Buy" or "Sell" to specify the trade direction.
- **Stop Loss and Take Profit Points:** Manually input the points for stop loss and take profit, or leave them blank to use the calculated values.
- **Use Risk Management:** Enable or disable the risk management feature.
- **Risk-to-Reward Ratio:** Specify the desired risk-to-reward ratio.
- **Account Balance:** Input the total account balance.
- **Risk Percentage:** Specify the percentage of the account balance to risk on each trade.
- **Visual Options:** Customize the colors of the entry, stop loss, and take profit lines, and choose to show or hide these lines and their corresponding labels.
- **Calculations:**
- If risk management is enabled, the indicator calculates the stop loss points based on the risk amount (account balance * risk percentage) and the current price. The take profit points are then calculated using the specified risk-to-reward ratio.
- If risk management is disabled, the indicator uses the manually input stop loss and take profit points.
- **Visual Representation:**
- The indicator plots the entry price as a horizontal line on the chart.
- The stop loss and take profit levels are plotted as horizontal lines above or below the entry price, depending on the trade direction.
- Labels showing the exact stop loss and take profit prices are also displayed, providing clear and immediate information.
- **Alerts:**
- The indicator sets up alerts to notify the trader when the price hits the stop loss or take profit levels. These alerts can be configured to trigger once per bar close, ensuring timely notifications.
**How It Helps Traders:**
The Auto Risk Manager simplifies the risk management process by automating the calculation and visualization of critical trade levels. This helps traders to:
- Maintain consistent risk management practices.
- Avoid emotional decision-making by predefining risk and reward levels.
- Save time by automating the calculation of stop loss and take profit levels.
- Stay informed with timely alerts for important trade events.
- Customize the visual representation of trade levels to suit their preferences.
**Instructions for Use:**
1. **Add the Indicator:** Add the "Auto Risk Manager" indicator to your TradingView chart.
2. **Configure Inputs:**
- Select the trade direction (Buy or Sell).
- Enter stop loss and take profit points if you want to use manual values.
- Enable risk management and configure the risk-to-reward ratio, account balance, and risk percentage if you want automatic calculations.
- Customize the visual settings as desired.
3. **Review Trade Levels:** The entry, stop loss, and take profit levels will be plotted on the chart. Review these levels to ensure they align with your trading strategy.
4. **Monitor Alerts:** Set up alerts to receive notifications when the price hits the stop loss or take profit levels.
5. **Execute Trades:** Use the plotted levels to guide your trade entries and exits, ensuring you adhere to your predefined risk management strategy.
The Auto Risk Manager is a powerful tool for traders looking to enhance their trading discipline and efficiency. By automating the risk management process, this indicator allows traders to focus on other aspects of their trading strategy while ensuring consistent adherence to their risk tolerance.
Automated Round Number Crossing Analysis [@Mishu]Hello, TradingView community! I'm thrilled to present the "Automated Round Number Crossing Analysis" script, a sophisticated tool designed to help traders identify and analyze key psychological thresholds in the financial markets. This indicator leverages the concept of round numbers to enhance trading strategies, providing a comprehensive analysis of price levels and their interactions.
Key Features:
Round Number Levels: This script automatically calculates and plots multiple round number levels based on a user-defined middle price (MRN) and gap value. These levels are displayed on the chart, allowing traders to visually identify significant price points.
Crossing Analysis: The script counts various types of crossings for each round number level within a specified lookback period:
Cross Up: The price crosses above the level.
Cross Down: The price crosses below the level.
High Over Close Below: The high of the bar is above the level, but the close is below.
Low Under Close Above: The low of the bar is below the level, but the close is above.
Table Display: Users can enable a detailed table that summarizes the crossing counts and percentages for each level. The table is highly customizable, with options to adjust its position, text size, and the data displayed.
Customizable Plot Settings: Users have the flexibility to show or hide the levels and their labels. The script provides various customization options for label positions, colors, and text styles, ensuring that the indicator can be tailored to individual preferences.
Comprehensive Analysis: By analyzing price interactions with round number levels, traders can gain insights into potential support and resistance zones. This can be particularly useful for developing and refining trading strategies.
Table Display Details:
The table shows the following information for each level:
Level Name: Identifies the round number level.
Cross Up Count: Number of times the price crossed above the level.
Cross Down Count: Number of times the price crossed below the level.
High Over Close Below Count: Number of times the high was above but the close was below the level.
Low Under Close Above Count: Number of times the low was below but the close was above the level.
Total Crossings: The sum of all crossing counts for the level.
Percentage of Total Crossings: The percentage of the total crossings that each level represents, providing a relative measure of the activity at each level.
How It Works:
Input Settings:
Starting Price (Middle) (MRN): The central price around which round numbers are calculated.
Gap: The interval between each round number level.
Lookback Period: The number of bars to consider for crossing analysis.
Table and plot customization options to adjust the display according to user preferences.
Level Calculation: The script calculates multiple levels above and below the MRN using the specified gap.
Crossing Counts: The script uses built-in Pine Script functions to count the various types of crossings for each level. It tracks these counts over the lookback period, updating them as new bars are added.
Table Display: If enabled, a table is displayed on the chart showing the crossing counts and percentages for each level. This table helps traders quickly understand the significance of each level.
Labels and Plots: The script plots the levels on the chart and optionally displays labels indicating the level names and their corresponding prices. These labels are updated in real-time as the chart evolves.
Usage:
Support and Resistance Identification: The indicator helps traders identify potential support and resistance zones based on round numbers, which are often psychological levels in the market.
Strategy Development: By analyzing how often the price interacts with these levels, traders can develop strategies that take advantage of these key points.
Market Analysis: The comprehensive crossing analysis provides deeper insights into market behavior, allowing for more informed trading decisions.
Example Use Case:
Imagine you are trading the S&P 500 and want to identify key levels where the price might reverse or accelerate. By setting the MRN to the current price and adjusting the gap to a suitable value (e.g., 50 points), the script will plot horizontal lines at these intervals. The crossing analysis will then show how often the price interacts with these levels, helping you pinpoint significant zones for potential trades.
This script is a valuable addition to any trader's toolkit, providing a structured way to analyze round number levels and their impact on price action. I hope you find it useful for your trading activities. Happy trading!
9:30 Opening Price MarkerIndicator Name: 9:30 Opening Price Marker
Description:
The "9:30 Opening Price Marker" is a custom indicator for TradingView that highlights the opening price at 9:30 AM in the UTC-4 time zone (Eastern Daylight Time) on the chart. It helps traders and analysts easily identify and track the price level at which the market opens each day.
Features:
Timezone Conversion: The indicator converts the current time to the UTC-4 timezone (Eastern Daylight Time) to accurately determine the 9:30 AM opening price.
Visual Marker: It visually marks the opening price with a dotted line on the chart, making it prominent for quick reference.
Label: Additionally, it includes a label next to the opening price line, indicating "9:30 Opening Price", enhancing clarity and usability.
Overlay: The indicator is designed to overlay on the price chart, ensuring it doesn't clutter other technical analysis tools or indicators.
Usage:
Day-to-Day Analysis: Traders can use this indicator to quickly gauge market sentiment at the daily opening, which can influence intraday trading strategies.
Reference Point: Acts as a reference point for identifying price movements and potential trading opportunities relative to the day's opening price.
Time-Specific Insights: Provides insights into price action immediately following the market open, aiding in decision-making based on early trading activity.
Installation: Copy the provided Pine Script code into TradingView's Pine Editor, save the script as an indicator, and apply it to your chart.
Disclaimer : This indicator is intended for informational purposes only and should not be solely relied upon for trading decisions. Always consider multiple sources of information and perform thorough analysis before executing trades.
Curved Smart Money Concepts Probability (Zeiierman)█ Overview
The Curved Smart Money Concepts Probability indicator, developed by Zeiierman, is a sophisticated trading tool designed to leverage the principles of Smart Money trading. This indicator identifies key market structure points and adapts to changing market conditions, providing traders with actionable insights into market trends and potential reversals. The trading tool stands out due to its unique curved structure and advanced probability features, which enhance its effectiveness and usability for traders.
█ How It Works
The indicator operates by analyzing market data to identify pivotal moments where institutional investors might be influencing price movements. It employs a combination of adaptive trend lengths, multipliers for sensitivity adjustments, and pivot periods to accurately capture market structure shifts. The indicator calculates upper and lower bands based on adaptive sizes and identifies zones of overbought (premium) and oversold (discount) conditions.
Key Features of Probability Calculations
The Curved Smart Money Concepts Probability indicator integrates sophisticated probability calculations to enhance trading decision-making:
Win/Loss Tracking: The indicator tracks the number of successful (win) and unsuccessful (loss) trades based on the identified market structure points (ChoCH, SMS, BMS). This provides a historical context of the indicator's performance.
Probability Percentages: For each market structure point (ChoCH, SMS, BMS), the indicator calculates the probability of the next move being successful or not. This is presented as a percentage, giving traders a quantifiable measure of confidence in the signals.
Dynamic Adaptation: The probability calculations adapt to market conditions by considering the frequency and success rate of the signals, allowing traders to adjust their strategies based on the indicator’s historical accuracy.
Visual Representation: Probabilities are displayed on the chart, helping traders quickly assess the likelihood of future price movements based on past performance.
Key benefits of the Curved Structure
The Curved Smart Money Concepts Probability indicator features a unique curved structure that offers several advantages over traditional linear structures:
Noise Reduction: The curved structure smooths out short-term market fluctuations, reducing the noise often seen in linear structures. This helps traders focus on the true trend direction rather than getting distracted by minor price movements.
Adaptive Sensitivity: The curved structure adjusts its sensitivity based on market conditions. This means it can effectively capture both short-term and long-term trends by dynamically adapting to changes in market volatility, something linear structures struggle with.
Enhanced Trend Detection: By providing a more gradual transition between market phases, the curved structure helps in identifying trends more accurately. This is particularly useful in volatile markets where linear structures might give false signals due to their rigid nature.
Improved Market Structure Analysis: The curved structure's ability to adapt and smooth out irregularities provides a clearer picture of the overall market structure. This clarity is essential for identifying premium and discount zones, as well as mid-range support and resistance levels, which are crucial for effective ICT Smart Money Trading.
█ Terminology
ChoCH (Change of Character): Indicates a potential reversal in market direction. It is identified when the price breaks a significant high or low, suggesting a shift from a bullish to bearish trend or vice versa.
SMS (Smart Money Shift): Represents the transition phase in market structure where smart money begins accumulating or distributing assets. It typically follows a BMS and indicates the start of a new trend.
BMS (Bullish/Bearish Market Structure): Confirms the trend direction. Bullish Market Structure (BMS) confirms an uptrend, while Bearish Market Structure (BMS) confirms a downtrend. It is characterized by a series of higher highs and higher lows (bullish) or lower highs and lower lows (bearish).
Premium: A zone where the price is considered overbought. It is calculated as the upper range of the current market structure and indicates a potential area for selling or shorting.
Mid Range: The midpoint between the high and low of the market structure. It often acts as a support or resistance level, helping traders identify potential reversal or continuation points.
Discount: A zone where the price is considered oversold. It is calculated as the lower range of the current market structure and indicates a potential area for buying or going long.
█ How to Use
Identifying Trends and Reversals: Traders can use the indicator to identify the overall market trend and potential reversal points. By observing the ChoCH, SMS, and BMS signals, traders can gauge whether the market is transitioning into a new trend or continuing the current trend.
Example Strategies
⚪ Trend Following Strategy:
Identify the current market trend using BMS signals.
Enter a trade in the direction of the trend when the price retraces to the mid-range zone.
Set a stop-loss just below the mid-range (for long trades) or above the mid-range (for short trades).
Take profit in the premium/discount zone or when a ChoCH signal indicates a potential reversal.
⚪ Reversal Strategy:
Wait for a ChoCH signal to identify a potential market reversal.
Enter a trade in the direction of the new trend as indicated by the SMS signal.
Set a stop-loss just beyond the recent high (for short trades) or low (for long trades).
Take profit when the price reaches the premium or discount zone opposite to the entry.
█ Settings
Curved Trend Length: Determines the length of the trend used to calculate the adaptive size of the structure. Adjusting this length allows traders to capture either longer-term trends (for smoother curves) or short-term trends (for more reactive curves).
Curved Multiplier: Scales the adjustment factors for the upper and lower bands. Increasing the multiplier widens the bands, reducing sensitivity to price changes. Decreasing it narrows the bands, making the structure more responsive.
Pivot Period: Sets the period for capturing trends. A higher period captures broader trends, while a lower period focuses on short-term trends.
Response Period: Adjusts the structure’s responsiveness. A low value focuses on short-term changes, while a high value smoothens the structure.
Premium/Discount Range: Allows toggling between displaying the active range or previous range to analyze real-time or historical levels.
Structure Candles: Enables the display of curved structure candles on the chart, providing a modified view of price action.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
BE-NSE-Distributed Straddle Intraday Trading StrategyHerewith publishing the script (not the Indicator!) for the benift of Option Traders. I call this a script as this doesn't perform any kind of analysis of candle data and provide general BUY | SELL information. This Script is based on the TRUE VALUES concept which is nothing but LTP.
Idea Behind this Script:
As an option seller i need the lower risk option premium to trade. so that, time can work in our favor. basic question which we get at the first is which option to choose out of many available.
If traders feel the question is apt then this script is for them.
Logic Behind this script:
Upon Market Open, script in the BACKEND ( Under the hood ) deployes 60 possible combinations of STRADDLES for sampling, and continue to monitor the LTP movements and compares it against opposite pairs. lets say out of 30 Straddle options one of the Straddle it picked is ATM CE VS ATM PE. for 1 rs move in underlying how much impact is happening in CE VS PE.
This simple anlysis is done at every 30 seconds. once the Analysis is complete it picks 4 options 2 on the CALL side and 2 on the PUT side, which script feels the movement of prices are smooth. SMOOTH refers that time decay that can work in our favor..
Calculations behid the script:
lets say BNF LTP is 52000 at 9:20 AM, and one of the pair script took for sampling was ATM CE vs PE which are having the LTP of 100 each.
At 9:35 AM, BNF is trading at 52075, and ATM CE is reading the LTP of 122 and ATM PUT is reading the LTP of 70. ideally LTP of Call should be around 135 and Put should be around 65 considering the usual delta of 0.48 . Net Money Index for this Pair Sample is 8
Call Side => 100 - 122 = -22
Put Side => 100 - 70 = 30
Money Index => 30 - 22 = 8 for 15 Min
This Money index is calculated across choosen samples and the Option strikes is provided as an output which has mere possiblity of working in Options Seller's favor.
How to Read the Output:
For the choosen strikes from the time of Entry (Suggested Entry time by script) till the current time, the bottom pane plots the Money index as columns. Green Columns indicate that how much option premium eroded due to time decay. Red Columns indicate that how much Option premium increased during the time.
Note: Script dynamically calculate the strikes and suggests in realtime.
WARNING or a Humble Request:
For those who don't understand the word "Repaint" how it works in Pine Script. plz don't consider using this script. For those who wish to understand I have kept the Observer mode in the settings which shall guide you on why the Money Index shown on the chart when the MARKET IS CLOSED is different than when the MARKET IS OPEN (Realtime).
Disclaimer:
I have tested the script only in BNF and not sure if this works on Nifty, FinNifty or others. you may still try and plz do provide the feedback for improvising the script.
----- BreathEasy --------
The information contained in my scripts/indicators/ideas does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, or individual’s trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My scripts/indicators/ideas are only for educational purposes!