FOREX Master Pattern Trend Finder by nnamdertWhat does this Indicator do?
This indicator works by identifying Trends and "potential" shifts in trends before they happen. It is technically a momentum indicator that watches for specific Bullish or Bearish momentum (i.e. Bull Runs, and Crashes).
How does it do this?
It uses a custom script that takes into account extremes in price and certain moving averages and other accurate forward looking indicators. Once it finds a Bull run, signals are triggered in the form of PLUS signs. It does the same for strong Bearish trends. Based on how the script is configured, the Indicator is able to spot (in advance) unique movement in the trend that can predict a change in momentum prior to the change occurring.
These momentum changes can be configured as alerts.
As seen in the screenshot below the indicator triggers "early warning" signals when it detects a specific movement that is indicative of a potential change in momentum or trend. It does this IN ADVANCE of any change - it is ONLY A PREDICTION but allows the trader to look at the asset to determine if the potential change in trend is valid and gives the trader enough time to set up a trade and stop-loss.
As seen in the screenshot below color-coded candles allow the trader to visually SEE the change on the chart making it easier to get a quick glance at the current trend. In addition, Green and Red Crosses were added to the oscillator to help easily identify trends if the color coded candle feature is turned OFF. These Red and Green Crosses are not located at every highlighted bar location, rather, at the first bar that the alert was triggered on. If there was a gap in the trend, the alert triggers, and plots again when a new trend starts.
As seen in the screenshot below, when a strong trend is present in either direction, small red or green dots are plotted on the oscillator. This makes spotting past and current trends much easier. Even if the price is not moving up or down, this indicates strong underlying buying or selling pressure.
Some traders like using indicators as a reversal finder. Although this indicator is NOT A REVERSAL INDICATOR, I added a signal that can be used as a "potential" reversal finder. You can see this in the screenshot below.
These "reversal" signals typically appear prior to a move in the opposite direction (but not always). A stop-loss can be set at the high or low of the previous bar depending on direction.
At times, multiple "conflicting" warning signals appear back-to-back. This is indicative of a "crab" in the market. Basically, indecision is present in the market. These "early warning" signals are smaller and either BLUE or ORANGE . Once a trend is recognized, the signal will be either RED or GREEN and a bit larger.
Viewing a higher timeframe will allow Forex Master Pattern traders to easily spot contraction zones. I manually draw the lines in at these zones. These "Value Lines" are typically respected in the future. As shown in the screenshot below, the level acted as support in the future and a newer value line was created at a "higher level" - this indicates a Bullish momentum in price as buyers and sellers have agreed upon the higher price as a true value area.
As seen in the screenshot below, multiple potential reversal signals plotted on the chart indicate a "weakening' in the strength of the current trend. This allows the trader to strategically move their stop-loss or simply take some profits off the table at this level.
This Indicator does NOT overlay on the current chart but allows the trader to see color coded bars. Simply double clicking within the indicator will expand the indicator to full screen, and double clicking within the chart itself will hide the secondary pane but keep the candles visible on the chart.
Happy Trading and GOOD LUCK!
Pattern
Hikkake Hunter 2.0This script serves as a successor to a previous script I wrote for identifying Hikkakes nearly two years ago.
The old version has been preserved here:
█ OVERVIEW
This script is a rework of an old script that identified the Hikkake candlestick pattern. While this pattern is not usually considered a part of the standard candlestick patterns set, I found a lot of value when finding a solution to identifying it. A Hikkake pattern is a 3-candle pattern where a middle candle is nested in between the range of the prior candle, and a candle that follows has a higher high and a higher low (bearish setup) or a lower high and a lower low (bullish setup). What makes this pattern unique is the "confirmation" status of the pattern; within 3 candles of this pattern's appearance, there must be a candle that closes above the high (bullish setup) or below the low (bearish setup) of the second candle. Additional flexibility has been added which allows the user to specify the number of candles (up to 5) that the pattern may have to confirm after its appearance.
█ CONCEPTS
This script will cover concepts mainly focusing on candlestick analysis, price analysis (with higher timeframes), and statistical analysis. I believe there is also educational value presented with the use of user-defined-types (UDTs) in accomplishing these concepts that I hope others will find useful.
Candlestick Analysis - Identification and confirmation of the patterns in the deprecated script were clunky and inefficient. While the previous script required the use of 6 candles to perform the confirmations of patterns (restricted solely to identifying patterns that confirmed in 3 candles or less), this script only requires 3 candles to identify and process patterns by utilizing a UDT representing a 'pattern object'. An object representing a pattern will be created when it has been identified, and fields within that object will be set for processing by the functions it is passed to. Pattern objects are held by a var array (values within the array persist between bars) and will be removed from this array once they have been confirmed or non-confirmed.
This is a significant deviation from the previous script's methods, as it prevents unnecessary re-evaluations of the confirmation status of patterns (i.e. Hikkakes confirmed on the first candle will no longer need to be checked for confirmations on the second or third; a pitfall of the deprecated version which required multiple booleans tracking prior confirmation statuses). This deviation is also what provides the flexibility in changing the number of candles that can pass before a pattern is deemed non-confirmed.
As multiple patterns can be confirmed simultaneously, this script uses another UDT representing a linked-list reduction of the pattern object used to process it. This liked-list object will then be used for Price Analysis.
Price Analysis - This script employs the use of a UDT which contains all the returns of confirmed patterns. The user specifies how many candles ahead of the confirmed pattern to calculate its return, as well as where this calculation begins. There are two settings: FROM APPEARANCE and FROM CONFIRMATION (default). Price differences are calculated from the open of the candle immediately following the candle which had confirmed the pattern to the close of the candle X candles ahead (default 10). ( SEE FEATURES )
Because of how Pine functions, this calculation necessitates a lookback on prior candles to identify when a pattern had been confirmed. This is accomplished with the following pseudo-code:
if not na(confirmed linked-list )
for all confirmed in list
GET MATRIX PLACEMENT
offset = FROM CONFIRMATION ? 0 : # of candles to confirm
openAtFind = open
percent return = ((close - openAtFind) / openAtFind) * 100
ADD percent return TO UDT IN MATRIX
All return UDTs are held in a matrix which breaks up these patterns into specific groups covered in the next section.
Higher Timeframes - This script makes a request.security call to a higher timeframe in order to identify a price range which breaks up these patterns into groups based on the 'partition' they had appeared in. The default values for this partitioning will break up the chart into three sections: upper, middle, and lower. The upper section represents the highest 20% of the yearly trading range that an asset has experienced. The lower section represents the trading range within a third (33%) of the yearly low. And the middle section represents the yearly high-low range between these two partitions.
The matrix containing all return UDTs will have these returns split up based on the number of candles required to confirm the pattern as well as the partition the pattern had appeared in. The underlying rationale is that patterns may perform better or worse at different parts of an asset's trading range.
Statistical Analysis - Once a pattern has been confirmed, the matrix containing all return UDTs will be queried to check if a 'returnArray' object has been created for that specific pattern. If not, one will be initialized and a confirmed linked-list object will be created that contains information pertinent to the matrix position of this object.
This matrix contains the returns of both the Bullish and Bearish Hikkake patterns, separated by the number of candles needed to confirm them, and by the partitions they had appeared in. For the standard 3 candles to confirm, this means the matrix will contain 18 elements (dependent on the number of candles allowed for confirmations; its size will range from 12 to 30).
When the required number of candles for Price Analysis passes, a percent return is calculated and added to the returnArray contained in the matrix at the location derived from the confirmed linked-list object's values. The return is added, and all values in the returnArray are updated using Pine's built in array.___ functions. This returnArray object contains the array of all returns, its size, its average, the median, the standard deviation of returns, and a separate 3-integer array which holds values that correspond to the types of returns experienced by this pattern (negative, neutral, and positive)*.
After a pattern has been confirmed, this script will place the partition and all of the aforementioned stats values (plus a 95% confidence interval of expected returns) related to that pattern onto the tooltip of the label that identifies it. This allows users to scroll over the label of a confirmed pattern to gauge its prior performance under specific conditions. The percent return of the specific pattern identified will later be placed onto the label tooltip as well. ( SEE LIMITATIONS )
The stats portion of this script also plays a significant role in how patterns are presented when using the Adaptive Coloring mode described in FEATURES .
*These values are incremented based on user-input related to what constitutes a 'negative' or 'positive' return. Default values would place any return by a pattern between -3% and 3% in the 'neutral' category, and values exceeding either end will be placed in the 'negative' or 'positive' categories.
█ FEATURES
This script contains numerous inputs for modifying its behavior and how patterns are presented/processed, separated into 5 groups.
Confirmation Setting - The most important input for this script's functioning. This input is a 'confirm=true' input and must be set by the user before the script is applied to the chart. It sets the number of candles that a pattern has to confirm once it has been identified.
Alert Settings - This group of booleans sets which types of alerts will fire during the scripts execution on the chart. If enabled, the four alerts will trigger when: a pattern has been identified, a pattern has been confirmed, a pattern has been non-confirmed, and show the return for that confirmed pattern in an alert. Because this script uses the 'alert' function and not 'alertcondition', these must be enabled before 'any alert() function call' is set in TradingView's 'alerts' settings.
Partition Settings - This group of inputs are responsible for creating (and viewing) the partitions that breaks the returns of the patterns identified up into their respective groups. The user may set the resolution to grab the range from, the length back of this resolution the partitions get their values from, the thresholds which breaks the partitions up into their groups, and modify the visibility (if they're shown, the colors, opacity) of these partitions.
Stats Settings - These inputs will drastically alter how patterns are presented and the resulting information derived from them after their appearance. Because of this section's importance, some of these inputs will be described in more detail.
P/L Sample Length - Defines the number of candles after the starting point to grab values from in the % return calculation for that pattern.
P/L Starting Point - Defines the starting point where the P/L calculation will take place. 'FROM APPEARANCE' will set the starting point at the candle immediately following the pattern's appearance. 'FROM CONFIRMATION' will place the starting point immediately following the candle which had confirmed the pattern. ( SEE LIMITATIONS )
Min Returns Needed - Sets how many times a specific pattern must appear (both by number of candles needed to confirm and by partition) before the statistics for that pattern are displayed onto the tooltip (and for gradient coloration in Adaptive Coloring mode).
Enable Adaptive Coloring - Changes the coloration of the patterns based on the bullish/bearishness of the specified Gradient Reference value of that pattern compared to the Return Tolerance values OR the minimum and maximum values of that specified Gradient Reference value contained in the matrix of all returns. This creates a color from a gradient using the user-specified colors and alters how many of the patterns may appear if prior performance is taken into account.
Gradient Reference - Defines which stats measure of returns will be used in the gradient color generation. The two settings are 'AVG' and 'MEDIAN'.
Hard Limit - This boolean sets whether the Return Tolerance values will not be replaced by values that exceed them from the matrix of returns in color gradient generation. This changes the scale of the gradient where any Gradient Reference values of patterns that exceed these tolerances will be colored the full bullish or bearish gradient colors, and anything in between them will be given a color from the gradient.
Visibility Settings - This last section includes all settings associated with the overall visibility of patterns found with this script. This includes the position of the labels and their colors (+ pattern colors without Adaptive Coloring being enabled), and showing patterns that were non-confirmed.
Most of these inputs in the script have these kinds of descriptions to what they do provided by their tooltips.
█ HOW TO USE
I attempted to make this script much easier to use in terms of analyzing the patterns and displaying the information to the user. The previous script would have the user go to the 'data window' side bar on TradingView to view the returns of a pattern after they had specified which pattern to analyze through the settings, needlessly convoluted. This aim at simplicity was achieved through the use of UDTs and specific code-design.
To use, simply apply the indicator to a chart, set the number of candles (between 2 and 5) for confirming this specific pattern and adjust the many settings described above at your leisure.
█ LIMITATIONS
Disclaimer - This is a tool created with the hopes of helping identify a specific pattern and provide an informative view about the performance of that pattern. Previous performance is not indicative of future results. None of this constitutes any form of financial advice, *use at your own risk*.
Statistical Analysis - This script assumes that all patterns will yield a NORMAL DISTRIBUTION regarding their returns which may not be reflective of reality. I personally have limited experience within the field of statistics apart from a few high school/college courses and make no guarantees that the calculation of the 95% confidence interval is correct. Please review the source code to verify for yourself that this interval calculation is correct (Function Name: f_DisplayStatsOnLabel).
P/L Starting Point - Because of when the object related to the confirmation status of a pattern is created (specifically the linked-list object) setting the 'P/L Starting Point' to 'FROM APPEARANCE' will yield the results of that P/L calculation at the same time as 'FROM CONFIRMATION'.
█ EXAMPLES
Default Settings:
Partition Background (default):
Partition Background (Resolution D : Length 30):
Adaptive Coloration:
Show Non-Confirmed:
DojiCandle body size RSI-SMMA filter MTF
DojiCandle body size RSI-SMMA filter MTF
Hi. I was inspired by a public script written by @ahmedirshad419, .
I thank him for his idea and hard work.
His script is the combination of RSI and Engulfing Pattern.
//------------------------------------------------------------
I decided to tweak it a bit with Open IA.
I have changed:
1) candle pattern to DojiCandle Pattern;
2) I added the ability for the user to change the size of the candlestick body;
3) Added SMMA 200;
4) Changed the colour of SMMA 200 depending on price direction;
5) Added a change in the colour of candlesticks, depending on the colour of the SMMA 200;
6) Added buy and sell signals with indicator name, ticker and close price;
7) Added ability to use indicator on multi time frame.
How it works
1. when RSI > 70 > SMMA 200 and form the bullish DojiCandle Pattern. It gives sell signal
2. when RSI < 30 < SMMA 200 and form the bearish DojiCandle Pattern. It gives buy signal
settings:
basic setting for RSI, SMMA 200 has been enabled in the script to set the levels accordingly to your trades
Enjoy
Tailored-Custom Hamonic Patterns█ OVERVIEW
We have included by default 3 known Patterns. The Bat, the Butterfly and the Gartley. But have you ever wondered how effective other,
not yet known models could be? Don't ask yourself the question anymore, it's time to find out for yourself! You have the option to customize
your own Patterns with the Backtesting tool and set Retracement Ratios and Targets for your own Patterns. In addition to this, in order to determine
the Trend at a glance and make Pattern detection more efficient, we have linked the calculation of Patterns to Bands of several types to choose
from (Bollinger, Keltner, Donchian) that you can select from a drop-down menu in the settings and play with the Multiplier
and the Adaptive Length of the Patterns to see how it affects the success rate in the Backtesting table.
█ HOW DOES IT WORK?
- Harmonic Patterns
-Pattern Names, Colors, Style etc… Everything is customizable.
-Dynamic Adaptative Length with Min/Max Length.
- XAB/ABC Ratio
-Min/Max XAB/ABC Configurable Ratio for each Pattern to create your own Patterns.
(This is really the particular option of this Indicator, because it allows you to be able to Backtest in real time
after having played at configuring your own Ratios)
- Bands
-Contrary to the original logic of the HeWhoMustNotBeNamed script, here when the price breaks out of the upper Bands
(example, Bollinger band, Keltner Channel or Donchian Channel) , with a predetermined Minimum and Maximum Length and Multiplier, we can consider
the Trend to be Bearish (and not Bullish) and similarly when the price breaks down in the lower band, we can consider the Trend
to be Bullish (not Bearish) . We have also added the middle line of the Channels (which can be useful for 'Scalper' type Traders.
-The Length of the Bands Filter is directly related to the Dynamic Length of the Patterns.
-You can use a drop-down menu to select from the following Bands Filters :
SMA, EMA, HMA, RMA, WMA, VWMA, HIGH/LOW, LINREG, MEDIAN.
-Sticky and Adaptive Bands options has been included.
- Projections
-BD/CD Projection Ratio configurable for each Pattern.
(Projections are visible as Dotted Lines which we can choose to Extend or not)
- Targets
-Target, PRZ and Stop Levels are set to optimal values based on individual Patterns. (The PRZ Level corresponds to point D
of the detected Pattern so its value should always be 0) but you can change the Targets value (defined in %) as you wish.
Again here, you have the option to fully configure the Style and Extend the Lines or not.
- Backtesting Table
-As said previously, with the possibility of testing the Success Rate of each of the 3 Customizable Patterns,
this option is part of the logic of this Indicator.
- Alerts
-We originally believe that this Indicator does not even need Alerts. But we still decided to include at least one Alert
that you can set for when a new Pattern is detected.
█ NOTES
Thanks to HeWhoMustNotBeNamed for his permission to reuse some part of his zigzag scripts.
Remember to only make a decision once you are sure of your analysis. Good trading sessions to everyone and don't forget,
risk management remains the most important!
The Candle Hunter Candlestick Pattern - by Karoshi TradingThe Candle Hunter Indicator - by Karoshi Trading
The Candle Hunter Indicator is based on specific Candlesticks and Patterns.
Activating this indicator will mark all specific Bullish & Bearish Candles on the Chart.
Depending on your settings, not all candles will be displayed on the chart.
The goal of this indicator is, to highlight all the important trending candles and ignore all ranging candles.
This can be helpful for rejecting/bouncing zones or S&R Levels. Or even if you like to trade reversals, you do not want to trade it on low volume ranging candles.
This indicator should only be used as a supplementary tool while trading, not as a stand alone.
Which Candles & Pattern will be marked on the chart?
1# Pinbar / Hammer (multiple Variations)
2# Marubozu Candles (multiple Variations)
3# Engulfing Candles (Multiple Variations)
How does this indicator works?
First of all, the indicator has to calculate 3 different parameters, before marking one of the given candle. To do so, we will need the average volume, average candle size and the specific candles.
1st Parameter: Defining the needed Candles
First of all, the indicator will calculate, based on the opening & closing price and also the wick (range of each candle). If one of the calculation is a match, for the mentioned candles above, we come to step 2.
2nd Parameter: Average Candle Size
The next one is the size of each candle, compared to the average candle on the chart.
You can customize the settings, but in this example, we want the specific candle be at least 1.5 times the size of the average last 14 candles.
3rd Parameter: Average Volume
The indicator will now calculate the average volume of the last selected candles period (default settings = 14) and compare it to the current candle. In this example, the current candle should be at least 1.5 times the average volume.
The indicator provides two possibilities to calculate the average volume:
1# Volume MA = Volume Moving Average
2# Volume SA = Volume Simple Average
Result: Colorizing the given Candle
After all parameters were met, the indicator will colorize and mark with a label + name all the candles on the chart.
Special Settings:
1st The Engulfing Candles, have 3 different options:
1# Classic = Only the body of the previous candle has to be engulfed by the current candle
2# Reinforced = The full candle + wick of the previous candle has to be engulfed
3# Multiple Candles = Minimum 3 previous candles has to be engulfed to be marked on the chart
The numbers of candles are changeable and you can have all 3 options simultaneously active.
That means, that the code will check all 3 options to see if there is a match.
2nd Marubozu Candle
You can set the ratio between body compared to wick in the settings. Depends if you want full marubozu candles or also the variations of it.
3rd Hammer Wick
You can decide how much bigger the wick should be, compared to the body of the candle. The default settings are set on 1.5 times.
You can also set the position of the body. As example if the settings are set on 30%, the body of the hammer should be on the upper half of a bullish hammer or the lower 30% of the candle if bearish.
wedges and flagsThis script identifies chart patterns: wedges, flags, triangles on the chart
It has many settings. You can choose by which extremums you want to identify patterns - by the edges of wicks (tails, shadows), or by the edges of candle bodies .
You can also adjust the accuracy - how smooth and accurate the shapes must be in order for them to be considered wedges or triangles.
You can also customize other parameters of the figure, for example, how long the flagpole should be in order to consider such a figure a wedge, a flag or a triangle.
You can also set how large the allowable spread of candles relative to the flagpole can be.
The Sensitivity parameter - will allow you to control the number of patterns detected depending on whether you want the patterns to be detected more often, or if they cover more candles and thus be more reliable
You can also customize your styles.
All key settings are accompanied by tooltips
FOREX MASTER PATTERN Companion ToolWhat This Indicator Does
The Forex Master Pattern uses candlesticks, which provide more information than line, OHLC or area charts. For this reason, candlestick patterns are a useful tool for gauging price movements on all time frames. While there are many candlestick patterns, there is one which is particularly useful...
The Engulfing Pattern
An engulfing pattern provides an excellent trading opportunity because it can be easily spotted and the price action indicates a strong and immediate change in direction. In a downtrend, an up candle real body will completely engulf the prior down candle real body (bullish engulfing). In an uptrend a down candle real body will completely engulf the prior up candle real body (bearish engulfing).
Used in conjunction with the FOREX Master Pattern value line, the Engulfing Pattern can assist the trader with reversal timing or trend confirmation during the expansion and trend phases.
As shown in the screenshot below. Engulfing Candles usually precede a sharp move in price in the direction of the engulfing candle.
As shown in the screenshot below, when the Show Lines option is ON while using the indicator, both red and green lines are drawn on the chart automatically when engulfing candles form. These lines are projected forward 100 bars and tend to be reliable support and resistance areas. These areas are typically hidden from view.
In addition to the Show Lines option, the indicator (by default) creates boxes around trading zones that are created when an engulfing candle is formed. (There is an option to hide these from view if desired).
As seen in the screenshot below, these areas / zones are wider than a line and encompass a resistance / support zone rather than a specific price. Liquidity is usually high in these areas and a lot of selling / buying occurs here. These zones are drawn in advance out into the future giving the trader an idea of where price will revert to eventually.
A combination of LINES and AREAS can be used giving the user a better idea of where within the zone price will go.
As seen on the screenshot below, this combination provides a pretty accurate indication of the reversal point well in advance.
As seen in the screenshot below, when a ZONE / AREA has been fully breached (crossed) by price, the area is deactivated an no longer continues forward on the chart. Until price breaches an area, it remains valid and continues on the chart until and only if it is breached by price.
The Indicator is fully customizable.
The use can change the color of the engulfing candles, the color of the zones, transparency etc. You can turn OFF or ON any of the features such as lines, zones, bar coloring, and plotted arrows.
I really hope you get value from this indicator and... HAPPY TRADING!!
Double Top/Bottom [Early]Early Double Top & Bottoms
This script will scan pivot highs/lows as well as the macro highs/lows to determine whether it thinks there could be a potential double top or double bottom.
This does not mean there definitely will be but the indicator from this point will display the proposed pattern and set out a box where you could look for reversal signals.
The simple premise is rather than having to wait like most pattern scripts this will identify the pattern much sooner and set you up so you can decide how you would like to take action.
Settings
You have the option to choose what type of alert you would like to receive, one option is for an alert soon as the pattern is detected, the 2nd is for when price break the neckline.
below in the settings you have an option to determine what classifies a break. Either the price has to close over the neckline or it can be just a wick, up to you.
You can change all colours of the patterns, labels and line styles.
There are extra labels which can help explain when the pattern is spotted or point out when the neckline is broken depending on your choices
You can also change the frequency in which the patterns will be spotted where 1 is the lowest. We currently believe that 1 spots enough patterns however if you want more feel free to change this.
Use Cases
One is to simply try DCA into the Box if the DB / DT lines up with your support or resistance,.
Another way you can use this on the neckline breaks to confirm the pattern, in the settings you have an option to decide whether you want the close or the wick to trigger the neckline break.
Thirdly, one which we have had the most success with is lining the box plays up with divergence signals.
Feel free to leave any suggestions, happy for the feedback!
1-2-3 Pattern (Expo)█ Overview
The 1-2-3 pattern is the most basic and important formation in the market. Almost every great market move has started with this formation. That is why you must use this pattern to detect the next big trend. In fact, every trader has used the 1-2-3 formation to detect a trend change without realizing it.
Our 1-2-3 Pattern (Expo) indicator helps traders quickly identify the 1-2-3 Reversal Pattern automatically. By analyzing the price action data, the indicator shows the pattern in real-time. When the pattern is discovered, the 1-2-3 Pattern (Expo) Indicator notifies you via its built-in alert feature! Catching the upcoming big move can't be that much simpler.
█ How to use
The 1-2-3 pattern is used to spot trend reversals. The pattern indicates that a trend is coming to an end and a new one is forming.
-----------------
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!
FunctionPatternFrequencyLibrary "FunctionPatternFrequency"
Counts the word or integer number pattern frequency on a array.
reference:
rosettacode.org
count(pattern)
counts the number a pattern is repeated.
Parameters:
pattern : : array : array with patterns to be counted.
Returns:
array : list of unique patterns.
array : list of counters per pattern.
usage:
count(array.from('a','b','c','a','b','a'))
count(pattern)
counts the number a pattern is repeated.
Parameters:
pattern : : array : array with patterns to be counted.
Returns:
array : list of unique patterns.
array : list of counters per pattern.
usage:
count(array.from(1,2,3,1,2,1))
FunctionDynamicTimeWarpingLibrary "FunctionDynamicTimeWarping"
"In time series analysis, dynamic time warping (DTW) is an algorithm for
measuring similarity between two temporal sequences, which may vary in
speed. For instance, similarities in walking could be detected using DTW,
even if one person was walking faster than the other, or if there were
accelerations and decelerations during the course of an observation.
DTW has been applied to temporal sequences of video, audio, and graphics
data — indeed, any data that can be turned into a linear sequence can be
analyzed with DTW. A well-known application has been automatic speech
recognition, to cope with different speaking speeds. Other applications
include speaker recognition and online signature recognition.
It can also be used in partial shape matching applications."
"Dynamic time warping is used in finance and econometrics to assess the
quality of the prediction versus real-world data."
~~ wikipedia
reference:
en.wikipedia.org
towardsdatascience.com
github.com
cost_matrix(a, b, w)
Dynamic Time Warping procedure.
Parameters:
a : array, data series.
b : array, data series.
w : int , minimum window size.
Returns: matrix optimum match matrix.
traceback(M)
perform a backtrace on the cost matrix and retrieve optimal paths and cost between arrays.
Parameters:
M : matrix, cost matrix.
Returns: tuple:
array aligned 1st array of indices.
array aligned 2nd array of indices.
float final cost.
reference:
github.com
report(a, b, w)
report ordered arrays, cost and cost matrix.
Parameters:
a : array, data series.
b : array, data series.
w : int , minimum window size.
Returns: string report.
Fake breakHi Traders,
I've developed an indicator which can detect fake-breaks on the chart.
In the following you'll find the definition of the fake break candles and also you will find how to recognize it on the chart with practical examples.
What is the fake break pattern?
Sometimes support and resistance lines broke with a full body and strong candles that gives us the idea of sharp movements on the chart but suddenly the next candle returns all the path of the previous candle. in this case we can say fake break is happening on the chart.
This indicator detect fake break patterns based on two criteria:
1. It uses AverageTrueRange indicator to measure the strength of the pattern.
2. The returning candle should engulf minimum 75% of the break candle.
This indicator plot 2 terms in the name of "FB-D" and "FB-U" that are abbreviations of the "Fake Break Down" and "Fake Break Up".
You can also set alerts to get notified when fake breakout happens on the chart.
Notice: This pattern is only acceptable in valid support and resistance zones and you can not rely on it everywhere on the chart (specially in the middle of the waves).
Notice: The source code of this indicator is open and you are allowed to use it on your scripts by mentioning the name of author.
Disclaimer: This is not a financial advice or any signal to buy or sell, the goal of developing such an indicator is to use for educational purposes.
VWAP/EMA50/EMA200We script this one for combining VWAP , EMA50 and EMA200. The tool is fantastic if traders know how VWAP , EMA work? Just adding this script in your favorite and work like charm:
VWAP: How to trade with that
- One of the simplest uses of the VWAP is gauging support and/or resistance.
- A trader who is long a stock can use the VWAP as a target exit if its trading below.
- A stock trading over intraday VWAP may be bullish , while a stock trading under may be bearish .
EMA 50/EMA200: How to trade with that timeframe 50-day or 200-day period
- Identify the trend of market in longterm
- Golden-cross (short term EMA cross above longterm EMA ) is call golden-cross signals. It is opportunity for buying.
- Deal-cross ( short term EMA cross below longterm EMA ) is call dead-cross signals. It is opportunity for selling.
- Identify support levels
- Identify resistance levels
Let me know if you see anything else that should be added/changed.
Fibonacci Timing PatternThe Fibonacci Timing Pattern is a price-based counter that seeks to determine short-term and medium-term reversals in price action. It is based on the following set of conditions:
* For a bullish Fibonacci timing signal: The market must shape 8 consecutive close prices where each close price is lower than the close prices from 3 and 5 periods ago.
* For a bearish Fibonacci timing signal: The market must shape 8 consecutive close prices where each close price is higher than the close prices from 3 and 5 periods ago.
The signals of the pattern are ideally used in a sideways market or used in tandem with the trend (bullish signals are taken in a bullish market and bearish signals are taken in a bearish market).
K's Reversal Indicator IK's reversal indicator I is a special combination between Bollinger bands and the MACD oscillator. It is a contrarian indicator that depends on the following conditions:
• A buy signal is generated whenever the current market price is below the 100-period lower Bollinger band while simultaneously, the MACD value must be above its signal line. At the same time, the previous MACD value must be below its previous signal line.
• A sell (short) signal is generated whenever the current market price is above the 100-period upper Bollinger band while simultaneously, the MACD value must be below its signal line. At the same time, the previous MACD value must be above its previous signal line.
The way to use K's reversal indicator is to combine it with your already long/short bias in a sideways/range market in order to maximize the probability of success.
Limitations of the indicator include the following:
• There are no clear exit rules that work well on average across the markets. Even though K’s reversal indicator gives contrarian signals, it does not show when to exit the positions.
• As with other indicators, it underperforms on some markets and is not to be used everywhere.
• False signals tend to occur during trending markets but there is no proven way to detect a false signal.
SpyGuyTrendTrackerWorking on official documentation at the moment!
As soon as I have that ready I will update this description to incorporate that information.
Basic knowledge:
The clouds are differentiated by EMA lengths and distortion values
Yellow: Short Term
Red: Mid Term
Blue Long Term
I will get finalized documentation ASAP, until then, have fun backtesting and creating your own strategies / ideas while using this indicator!
Candilator RSI [AstrideUnicorn]OVERVIEW
The name Candilator comes from blending the words "candlestick" and "oscillator". And as the name suggests, this indicator is a good old RSI plotted as a candlestick chart. To produce a candlestick chart, Candilator RSI calculates four RSI's based on the open, high, low, and close time series. It also has a candlestick patterns detection feature.
HOW TO USE
You can use Candilator RSI as a normal RSI to analyze momentum, detect overbought and oversold markets, and find the oscillator's divergences with the price. You can also get creative and apply all sorts of technical analysis to the RSI candlestick chart, including candlestick patterns analysis.
Candilator RSI can automatically scan the price for some candlestick patterns in the overbought and oversold zones. This feature can help detect price reversals early.
SETTINGS
The indicator settings are divided into two groups: Main Settings and Pattern Detection. In the Main Settings, you can find standard RSI settings. In the Pattern Detection part, you can turn on and off the automatic search for a particular candlestick pattern.
FunctionPatternDecompositionLibrary "FunctionPatternDecomposition"
Methods for decomposing price into common grid/matrix patterns.
series_to_array(source, length) Helper for converting series to array.
Parameters:
source : float, data series.
length : int, size.
Returns: float array.
smooth_data_2d(data, rate) Smooth data sample into 2d points.
Parameters:
data : float array, source data.
rate : float, default=0.25, the rate of smoothness to apply.
Returns: tuple with 2 float arrays.
thin_points(data_x, data_y, rate) Thin the number of points.
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
rate : float, default=2.0, minimum threshold rate of sample stdev to accept points.
Returns: tuple with 2 float arrays.
extract_point_direction(data_x, data_y) Extract the direction each point faces.
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
Returns: float array.
find_corners(data_x, data_y, rate) ...
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
rate : float, minimum threshold rate of data y stdev.
Returns: tuple with 2 float arrays.
grid_coordinates(data_x, data_y, m_size) transforms points data to a constrained sized matrix format.
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
m_size : int, default=10, size of the matrix.
Returns: flat 2d pseudo matrix.
Manual Backtest - Flat the ChartThis script is an utility tool for manual backtesting.
The main problem in backtesting a discretionary strategy is the bias of knowing the future result of the market, in this way all the market will be crushed into a flat line, this way you can avoid bias.
The way to use this indicator is easy and made by 4 step:
Step 1 : add to an asset you won't backtest and put the auto scale on
Step 2 : go to the asset you will backtest and scroll left until the date you want to start
Step 3 : use the replay function of tradingview (15 min chart won't go back more than 18 month)
Step 4: toggle off the indicator or remove from the chart (untill next asset to backtest)
That's not a complex indicator but is what you need to do a fair backtesting
Boom Hunter XLBoom Hunter XL is a professional trading tool designed to expose perfect entries and incredible exits. This complete ground up rebuild of Boom Hunter Pro is an absolute essential for any professional trader or anyone serious about trading. Boom Hunter XL includes many upgrades to the Pro version such as volume pressure analysis, improved pressure dots, two new support and resistance lines and volume breakout detection. It also has options to display current volume and average volume it the top right corner.
A new and improved Volume Pressure Analysis exclusive to Boom Hunter XL can be turned on or off in the settings. This provides relative volume information highlighting anomalies and key movements. It also shows volume pressure. Sometimes when crossing a support or resistance line it takes a lot of volume to move price just a little. When price action crosses or bounces off a SR line it requires very little volume to move the price a lot. What this means is traders can visually see price action getting pulled in or pushed away from a SR line. The current bar shows live directional pressure. Volume pressure is used to confirm entries and continuations.
Red wave is the main support resistance line dictating short term trend direction. Enter trades after the oscillator crosses through or even better with pressure dots or volume pressure. If the oscillator is above the red wave it is an up trend and if it is below its a down trend.
The gray wave shows medium term support/resistance and general trend. This line is much harder to cross. Price action can easily bounce within this wave or get rejected.
The strongest SR lines are the top and bottom gray lines. The resistance line will bottom out under pressure and expose a low point. Likewise the support line will roof and expose a high point.
When there is extreme pressure the gray line will drag. This signal suggests that price action will will pullback and retest and push again. Avoid entering trades in these moments as the true bottom/top has not been exposed. Following price action along longer timeframe charts will help find the true low/high.
Tracking traditional patterns makes it easy to find the next breakout and direction.
Bear patterns
Bull patterns
Volume breakouts
Drawing support and resistance lines
Example of some of the signals:
Combo 2/20 EMA & 3 Day Pattern This is combo strategies for get a cumulative signal.
First strategy
This indicator plots 2/20 exponential moving average. For the Mov
Avg X 2/20 Indicator, the EMA bar will be painted when the Alert criteria is met.
Second strategy
This startegy based on 3-day pattern reversal described in "Are Three-Bar
Patterns Reliable For Stocks" article by Thomas Bulkowski, presented in
January,2000 issue of Stocks&Commodities magazine.
That pattern conforms to the following rules:
- It uses daily prices, not intraday or weekly prices;
- The middle day of the three-day pattern has the lowest low of the three days, with no ties allowed;
- The last day must have a close above the prior day's high, with no ties allowed;
- Each day must have a nonzero trading range.
WARNING:
- For purpose educate only
- This script to change bars colors.
Auto Harmonic Pattern - PRO [AlgoScopes] V1Harmonic Patterns is a powerful tool for identifying potential reversal areas in the financial markets. Auto Harmonic Pattern Pro it is based on the work of Scott Carney, a renowned trader and author who developed the concept of harmonic patterns.
Scott Carney's extensive research and contributions have greatly enhanced our understanding of market patterns and their application in trading. Auto Harmonic Pattern Pro is adapted from Scott Carney's original work on harmonic patterns, as well as other sources that have contributed to the recognition and understanding of harmonic patterns beyond Carney's initial research.
Auto Harmonic Pattern Pro offers traders a valuable tool for identifying potential reversal zones in the markets. We would like to express our gratitude to Scott Carney for his pioneering work in developing harmonic patterns, as well as to the various contributors and sources that have expanded our knowledge and understanding of harmonic patterns beyond Carney's original research.
Remember to always practice proper risk management and combine the indicator's signals with other technical analysis tools for a comprehensive trading approach.
For more information about Scott Carney and his work on harmonic patterns, you can find additional resources on his official website.
💠 ABOUT THE SCRIPT
💎 DISPLAY
⚬ The following things are displayed by default on the chart
🔸 Live patterns in trade with XABCD labels. (filled major triangle)
🔸 Entry, Stop and Target levels on chart for all live patterns. Target level are dimmed along with reducing size when they become irrelevant
🔸 Open Trades Stat table - Show patterns ID, patterns name, status for patterns, size&age, Entry, I.Stop, T.Stop and Targets (TP1 - TP4).
⚬ Highlighted present stop (and/or trailing stop if is enabled) and next target
⚬ When there are multiple patterns on chart, Entry, Stop, and Target labels & lines & PRZ* boxes are created with specific distance from each other to provide clarity to the users
*(potential reversal zone)
⬜ SETTINGS
⚬ Let's talk about some of the settings. Almost all of these settings have already been optimized and tested over time, but for some tickers it might be better to do a new test.
💎 ZIGZAG
🔸 Length - Default is set to 8. User can change settings but it is a good idea to keep with fibonacci (5, 13, 21, 34, 55 etc)
🔸 Depth - This setting is for how many pivots indicator scan to find harmonic pattern. By default it is set as 200
🔸 Recursive Algorithm - Enabled will use recursive instead standard zigzag
💎 HARMONIC PATTERN SETTINGS
🔸 Trade Direction - Default is set to show all (bearish and bullish) harmonic patterns. Can be filtered to bullish or bearish direction.
🔸 Error Percent - Default is 8. That is error percent tolerance from perfect pattern ratio.
🔸 Maximum patterns - Maximum patterns allowed on chart at any time
⚬ When it reaches the maximum patterns and the indicator finds a new one, the old patterns will be removed
- (important for algo traders because alerts for those removed patterns will no longer be a trigger)
🔸 Pattern size
⚬ Without filter will show all patterns (regardless of size)
⚬ Show only patterns for user preference size (no more two patterns because is smaller of 280 bars)
🔸 External Filter - It can be used to filter harmonic patterns. You can build your own custom trend based scripts and use it with AHP to filter trades.
⚬ The structure of the external script must be
1 for Long/Bullish patterns
-1 for Short/Bearish patterns
2 for all (Long and Short patterns)
0 Trade is not allowed
🔸 Filter Pattern Starts
⚬ When Filter starts is enabled pattern will start for logical pivot (see example)
⚬ Disabled filter will show more patterns (still can be very profitable)
💎 STOP & ENTRY & TRAILING STOP
🔸 Trail Entry Price - If Entry is still not reached and the price is still in PRZ zone, at the new high/low will adjust Entry.
⚬ Open Stats table will show the first Entry (when patterns were found) as well as the last corrected Entry (when patterns reached Entry level).
⚬ Disable this option Entry will remain at the level when patterns are found.
🔸 Enable Targets (awaiting entry) - enabled will show potential Targets for "awaiting entry" patterns (not active patterns because they have not yet reached Entry).
⚬ The Open stats table will show all other information, risk %, R:R etc).
⚬ Risky trade but with very good R:R (not recommended for inexperienced traders, very high risk of trading hitting Stop before reaching a Target)
🔸 Stop Distance - By default is set to 5. That is percent from the last low/high when the pattern reaches Entry. Stop trail from price till pattern reached Entry level.
🔸 Entry Distance - By default is set to 16. Same for SL that is percent distance from live price. You can increase/decrease percent but remember you have to give space between live price and the entry.
⚬ If entry is close to price, trade will become active too quickly
⚬ Remember if you change Stop Distance as well as Entry Distance to check Risk : Reward (recommended R:R for the first target is about 1:1)
🔸 Trailing Type - Options for trailing type, Continuous, Stepped, Breakeven and Disabled.
⚬ Continuous - When the price reaches "Trailing Active" (initial level for activating the trailing stop), T.Stop will start from Entry or Initial Stop (based on "Trailing Starts") and follow the price by Distance or Percent (based on "Trailing by").
- example one (trailing starts from Initial Stop when TP1 reached by distance/price on picture 1 and by percent on picture 2)
- example two (trailing starts from Entry when TP1 reached by distance/price on picture 1 and by percent on picture 2)
⚬ Stepped - when price reaches Trailing Active (initial level for activating the trailing stop), T.Stop will move to the previous level
- (If "Trailing Active" is set to Target2, then T.Stop will move to Target1 when price reached TP2)
⚬ Breakeven - when price reaches Trailing Active (initial level for activating the trailing stop), T.Stop will move to Entry and stay there the entire time for that harmonic trade
- (till reached all targets or reached T.Stop)
🔸 Trailing Active - When will the Trailing Stop be activated ("Trailing Type" must be enabled)
🔸 Trailing by - Distance or Percent
⚬ Distance - T.Stop will follow live price by initial distance
⚬ Percent - T.Stop will follow live price by initial percent
🔸 Trailing Starts - Entry or Initial Stop
⚬ Entry - T.Stop will start trailing from Entry level
⚬ I.Stop - T.Stop will start trailing from initial Stop level
- (Check Continuous picture for information)
💎 TARGET
🔸 Base - The level from which the calculation for Targets is made.
🔸 Target 1/Target 4 dropdown - Targets are set by default and set in the dropdown most often used for those targets.
🔸 Target 1/Target 4 custom - If the desired ratio is not in the dropdown, then it is possible to manually enter the desired ratio.
⚬ (If you want to change some of the targets, maybe to confluence with support/resistance)
💎 PATTERNS
🔸 Harmonic Patterns Type
⚬ Enable/Disable harmonic patterns by Type of patterns (for Classic and Anti patterns)
⚬ By default all patterns are enabled (for standard patterns). Users can control and select/deselect all Classic, Anti or Non Standard patterns but also disable individual patterns.
⚬ For some patterns (like Shark and Navarro 200) we change PRZ or place in different Type groups. That is just cosmetic things.
🔸 Classic - This includes all and most popular Harmonic Patterns.
⚬ Gartley (Type I)
⚬ Bat (Type I)
⚬ Butterfly (Type II)
⚬ Crab (Type II)
⚬ Deep Crab (Type II)
⚬ Cypher (Type II)
⚬ Shark (Type III)
⚬ Nenstar (Type IV)
🔸 Anti Patterns
⚬ Anti Nenstar (Type I)
⚬ Anti Shark (Type II)
⚬ Anti Cypher (Type II)
⚬ Anti Crab (Type II)
⚬ Anti Butterfly (Type III)
⚬ Anti Bat (Type IV)
⚬ Anti Gartley (Type IV)
⚬ Navarro 200 (Type IV)
🔸 Non Standard -
⚬ White Swan
⚬ Black Swan
⚬ 3 Drive
⚬ Anti 3 Drive
⚬ Wolfe
⚬ Snorm
⚬ 121 Pattern
⚬ 5-0 Pattern
⚬ Sea Pony
⚬ Leonardo
💎 PATTERN DISPLAY OPTION
🔸 Pattern Lines Size - thickness for harmonic patterns
🔸 Pattern Lines Type - type for harmonic pattern lines (solid, dotted, dashed)
🔸 Fill XAB/BCD - major harmonic triangle
🔸 Fill ABC/XBD - minor harmonic triangle
🔸 Enable XABCD Label - labels for harmonic pattern
🔸 XABCD Label Size - size for harmonic xabcd labels
🔸 Enable Ratio Label & Line - lines and labels that connect harmonic patterns levels and that show the patterns ratio
🔸 Ratio Label Size - ratio labels size
⚬ Lines for pattern ratio are set by default dashed and can’t be changed.
💎 PRZ & ENTRY | STOP | TARGET SETTINGS
🔸 Entry & Stop & Target Labels - by default is set to small (opt small & normal)
🔸 Entry & Stop & Target Lines - by default is set to show lines & labels & price (opt lines & labels & price or lines & labels or disable all)
🔸 PRZ Box size - size in bars for PRZ box
⚬ Added option when it is not readable on chart pattern names or entry/stop/targets offset
⚬ Maximum (last pattern) can be drawn up to 500 bars in future or you will get error for script (use this option only when you need)
🔸 PRZ Box Type of Spacing - distance between PRZ boxes. "Auto" will make the maximum distance when there are more than 3 patterns on the chart for better visibility
- (the maximum can be projected up to 500 bars in the future)
🔸 PRZ Box Manual Spacing - manual distance between PRZ boxes if is “PRZ Box Type of Spacing” set to manual
💎 STATS AND DISPLAY
⚬ These settings can be used to manage display of open and close statistic tables
🔸 Open Trades - By default is enabled and set to the top right position.
🔸 Closed Trades - By default is disabled and set to bottom left position.
⚬ The size of the table can be changed (by default it is set to small)
🔸 Enable Tool Tip for Table - can be enabled/disabled. Shows important information for each section related to Open or Closed tables.
⚬ Recommended enabled until everything related to tables is understood, and later disabled (it starts to get annoying when you accidentally cross the tables with the mouse and tooltip box pop up)
💎 OPEN STATS
🔸 Percentage - show percentage for Targets and Stops
🔸 Risk/Reward - show patterns risk to reward for each Targets
🔸 Size/Age - show patterns size (from X to D in bars) and patterns age (distance in bars when patterns “In Trade”)
🔸 Live % & R:R - enabled will show live % and R:R if you take trade in that moment
💎 CLOSED STATS
🔸 Percentage - show stats by percent instead of numbers
🔸 Display Mode - Closed trade table have three display option, Compact, Detailed and Selective
⚬ Compact - show stats for Long/Bullish and Short/Bearish patterns
⚬ Selective - show stats just for active patterns
⚬ Detailed - show stats for each enabled patterns
- All stats is for “Backtest Bars” if enabled.
- I removed some things from the previous indicator (R:R as well as trailing R:R and win rate) because I think they are not relevant in Closed Table for trade or for statistics (Open Table have that)
💎 PATTERN | CHART COLOR THEME
⚬ By default it is set to Light color theme. Color theme will affect pattern lines, XABCD labels, ratio lines and label, entry/sl/targets labels and text in the open statistics table.
🔸 Dark Theme / Light Theme - Users can change any default individual color for dark or light theme (transparency too).
⚬ Light/Dark Theme suits dark or light chart background or user can change all color to preferred trade style.
⚬ Users have extra control to change all color to preferred trade style.
💎 ALERTS
⚬ Alerts - These settings help users to choose the type of alerts they want to receive.
🔸 New - New Harmonic Pattern is identified
🔸 Entry - Harmonic Pattern reached Entry level
🔸 Target 1/Target4 - Alert when patterns reached on of Target levels
🔸 Closure - Harmonic Pattern trade is closed. Reached all Targets or Stop or Trailing Stop (if is enabled)
🔸 Long & Short placeholders - Enabled will change for alerts Bullish/Bearish text for Long/Short text
⚬ example of custom alerts with some placeholders
💎 BACKTEST WINDOW
🔸 Backtest bars - Enabled will scan patterns for that bar range (default is set to 5000)
🔷 TOOL TIP
⚬ In setting you have help from tooltip to give you almost all this information for easy understanding. Hover mouse above tool tip and windows with info will appear.
⚬ On the chart, tool tip is added for each individual Harmonic pattern to show extra information (pattern ratio, type of harmonic and where often that pattern appears in Elliott wave fractal)
⚬ Tooltip for tables will also provide all the information related to Open and Closed tables. Disabled tooltip for tables will hide all information, but the tooltip for patterns will still remain.
🔴 Possible Errors
⚬ If a mistake is made in the settings and, for example, TP2 is set to 0.618 ratio and TP3 is changed to 0.5 ratio
- (the larger target is set to a smaller ratio than the smaller target), a red text will appear over most charts to indicate the error.
⚬ If Trailing Type is enabled and "Trailing Active" and "Trailing Starts" are set to the same level (Entry), a red text will appear on the charts to indicate an error
- (change "Trailing Active" to a higher level, TP1, or lower "Trailing Starts " to "I.Start")