Doji Hunter█ OVERVIEW
This script is built to search for 8 different Doji candlestick patterns in markets and makes them appear on screen with bar coloring and creating color-coded labels/shapes. It will identify the following variants based upon user input for various rules to abide by:
Gapping Up
Gapping Down
Gravestone
Dragonfly
Long-Legged
Rickshaw Man
Northern (Doji in uptrend)
Southern (Doji in downtrend)
Note: for the remainder of this description, the types for inputs will be marked by italic text.
█ OPTIONS
This script features a wide range of options available to the user to modify how it functions. The first set of inputs dictate how the trend analysis is done with moving averages. The second and third sets of inputs dictate specific rules for how Doji candles are analyzed and the colors used for when they appear.
█ INPUTS (short)
1 — Moving Average Rules:
The Northern and Southern Doji variants require some trend analysis which will be done by Moving Averages. The inputs in this section change various things about the moving average(s) to be used. In the second section of inputs, there is one boolean option that will nullify the need for trend detection and consolidates the Northern and Southern Doji variants into one.
2/3 — Doji Rules and Colors:
The next two sections of inputs correspond to the various rules that dictate how various doji variants will be analyzed, as well as the colors that correspond to each variant. The colors will also apply to each of the labels/shapes used.
4 — Diagnostics:
The last boolean will allow the user to see extra detail with regards to how and when dojis are detected. Note: This is not a part of any prior section and is simply included as a last functional item to the list of all inputs.
An example of multiple labels being shown on screen for various types of Dojis (DJI 1D chart):
█ INPUTS (extended)
1 — Moving Average Rules:
This section consists of 10 different inputs specific to the rules on how the moving average functions for trend analysis.
"Trend Rule" ( string list) determines which Moving Average will be used for trend detection. It has 3 options: "MA 1", "MA 2", or "BOTH". The second input "Trend Source" determines which OHLC (or combination) value to use in comparison to either MA 1 or MA 2 (EX: Trend Rule -> "MA 1" and Trend Source -> "close": if close > MA 1 -> uptrend, downtrend otherwise). If "BOTH" is selected then "Trend Source" is ignored and added nuance in the script ensures that the shorter MA being above the longer MA yields an uptrend (downtrend otherwise).
The next 8 inputs focus on 4 different parts of both MA 1 and 2.
Length ( integer(s) )
Color
Switch between SMA/EMA ( boolean(s) )
Source for MA
Note: Additional attention to detail has been made here as trend direction is ignored if "BOTH" is selected for the MA Rules and the lengths of both Moving Averages are set to be the same.
2/3 — Doji Rules and Colors:
The next two sections include 19 inputs that are related to how this script will analyze and identify the different variants of Doji candles.
"Identify Pattern On Close" ( boolean ) modifies which candles are to be used for determining when Doji candles are recognized. This changes an offset used for historical reference on some global variables which will force the script to only identify patterns after the current candle has closed.
"Doji Body Tolerance" ( float ) tells the script the maximum % the candle body may be of the high-low range to be considered a Doji candle.
"Doji Wick Sample" ( integer ) defines how many prior candles to sample from in calculating the current average upper and lower wick sizes.
"Simplify Northern/Southern Dojis" ( boolean ) makes this script ignore trend direction for Doji detection and consolidates Northern and Southern Dojis into being recognized as the same. This has an added effect of removing the plotted moving averages from the screen.
"Northern/Southern Display" ( string list ) that has multiple options for how Northern and Southern Dojis will be displayed on screen. Because of how labels may be extremely taxing on TradingView's servers to display, the default setting is "shapes" where Northern and Southern (N/S) Dojis will be marked with a colored triangle at the top of the candle. If "Simplify Northern/Southern Dojis" is true, all N/S Dojis will be marked with an x-cross instead. Other options include "labels" which enables the use of labels accompanied by their respective tooltip and color, or "none" where N/S Dojis will be only noticeable by their changed barcolor.
"Allow Gravestone/Dragonfly Shadows" ( boolean ) allows a bit of additional nuance to the definition of Gravestone or Dragonfly Dojis with small shadows.
"Gravestone/Dragonfly Shadow Tolerance" ( float ) defines the maximum % that the lower wick/upper wick (respectively) may be relative to the high-low range for Gravestone or Dragonfly Dojis to still be considered valid.
"Doji Long Wick Setting" ( string list) is a list of settings for three different ways of confirming if a Doji is Long-Legged. The settings are "one", "two", and "average". These define how many wick lengths of a candle need to exceed the calculated average wick lengths (EX: "both" -> upper wick length > upper wick average and lower wick length > lower wick average). The "average" setting will combine the lengths of both wicks and both prior wick averages, divide both of these sums by 2 and compare them instead.
"Doji Long Wick Tolerance" ( float ) defines how large compared to the averages that wick lengths need to be in order for them to be considered "Long-Legged" (EX: 1.50 -> upper/lower wick needs to exceed 150% the average of previous upper/lower wicks).
"Rickshaw Man Body Placement Tolerance" ( float ) defines how close to the high-low range's midpoint the candle body's midpoint needs to be in order for it to be considered a Rickshaw Man Doji candle instead.
The remaining 9 inputs define the colors to use for differentiating between all Doji variants this script will recognize.
█ USAGE
My hope for this script is that users find this easy to use/understand and will tinker with the input values to better identify Doji candlesticks across a wide range of markets.
Suggestions for changes in the future are welcome.
M-pattern
Volatility OscillatorThis tool displays relative volatility and directional trend. Excellent way to pickup diversions and reversals. Length can be lowered to 11 or 13 in settings to show price range.
Can be used to identify patterns such as parallel channels and likely direction of price action as pictured below.
Swing Failure Pattern Inquisitor SFP Inquisitor
v0.2a
coded by Bogdan Vaida
Code for Swing High, Swing Low and Swing Failure Pattern.
Note that we're still in the alpha version, bugs may appear.
Note that the number you set in your Swing History variable
will also be the minimum delay you see until the apples appear.
This is because we're checking the forward "history" too.
The SFP will only check for these conditions:
- high above Swing History high and close below it
- low below Swing History high and close above it
In some cases you may see an apple before the SFP that "doesn't fit"
with the SFP conditions. That's because that apple was drawn later and
the SFP actually appeared because of the previous apple .
20 candles later.
Legend:
🍏 - swing high
🍎 - swing low
🧺 - candle where the last swing was driven from
🍌 - swing failure pattern
🍎🍌 - hungry scenario: swing low but also a SFP compared to the last swing
Wedge MakerThis tool is used to draw wedges. Traders can choose which pivot points to draw lines from in settings. Wedge Maker does not automatically detect current wedge and is required to be tweaked in settings.
Test: Pattern RecognitionEXPERIMENTAL:
a test on how to compare price at different frequency's with static patterns.
Zidni Vertical Run Down Vertical Run UpVertical Run Down and Vertical Run Up based on Tom Bulkowski Chart Pattern with elaboration in percentage of the drop and up.
Bullish Piercing ScannerA piercing pattern is known in technical analysis to be a potential signal for a bullish reversal. The formation in its strictest form is rather rare, but tends to perform better the longer the downtrend in front of it. When technical studies such as RSI, Stochastic or MACD are showing a bullish divergence at the same time a piercing pattern appears, it strengthens the likelihood that this two-day pattern is meaningful.
This is a two-candle pattern. The previous candle must be bearish, the recent candle must open below the close of the previous candle, the recent candle must close above the middle of the previous candle. You can adjust the closing and opening gap between the two candles within this scanner's settings (price).
Candlestick Pattern IdentifierMy script builds upon another user-submitted script by rebuilding the logic used to identify candlestick patterns. The logic in my script is a mix of strict and lax guidelines to mitigate false flags and present valid buy and sell signals.
-To use this indicator, simply add it to any chart. It will identify trends on any time frame although the lower you go, the more signals you'll see and the higher probability of those signals being false flags. You can also disable any candlestick patterns that you feel are not as useful.
- This indicator works best with Stocks and also with Forex markets to a lesser extent.
- This indicator works the best on the Daily chart and also works (with varying degrees of success) on any timeframe at or above 1 hour. I've found that this indicator works the best when used in tandem with the Daily and Hourly charts with the Hourly chart being used to determine an entry point while the Daily chart is used for long term trend analysis.
123 Trend Continuation PatternThis simple indicator will help identify the 123 Patterns on the charts. It's build based on the zigzag indicator, which will work as a guideline to identify the 3 points. As soon as the price crosses the third point, the indicator will draw 3 lines: entry, take profit, and stop loss. Those lines will work as a reference and may help with other indicators. This kind of analysis will work on any time frame and symbol, but those markets that have high volatility may have better result
RSI W Pattern strategyThis strategy is similar to RSI V pattern strategy, but it looks for W pattern in RSI chart.
RULES
======
BUY
1. ema20 is above ema50
2. RSI5 crossing up 30 from oversold area
3. and RSI5 must be below overbought area (default value set to 65)
Add to existing Position
1. You can add on the next W pattern OR
2. if RSI5 is crossing up from below 20
Exit
1. when RSI5 reaches 75
Note: This is for short term/swing trading . which gets on when price dip in trending and quickly gets you out on RSI overbought area
Tweezer Scanner v1Some code for detecting tweezer candles, which are reversal patterns. You'll need to tweak the settings to be either less strict (more detections) or more strict (less detections). I found that if you follow the documentation for tweezers exactly, you will get very few detections. It is possible that this candlestick has become overused, so the original pattern itself has been lost to the noise of the market.
Settings:
1. Tweezer Max Body Height (Pips) - How tall can the body of the tweezer be, in pips (increase this pips to increase detections)
2. Tweezer Body Similarity (>%) - How similar should the body heights be, higher percentage is more similar (reduce this % to increase detections)
3. Tweezer Tail Similarity (>%) - How similar should the tail heights be, higher percentage is more similar (reduce this % to increase detections)
4. Tweezer Tail Proportion (<%) - How short should the opposite tail heights be, lower percentage is shorter and more similar to the documentation (increase this % to increase detections)
Vanilla ABCD PatternPatterns makes parts of the many predictive tools available to technical analysts, the most simples ones can be easily detected by using scripts. The proposed tool detect the simple (vanilla) form of the ABCD pattern, a pattern aiming to detect potential price swings. The script can use an additional confirmation condition that aim to filter potential false signals.
ABCD PATTERN
The ABCD pattern is not meant to be detected by analyzing individuals closing price observations but by analyzing longer term movements, this is done by using tools such as zig-zag. Like any pattern the ABCD one comes in different flavors, the simplest being based on the following structures:
Once price reach D we can expect a reversal. The classical pattern has the following conditions : BC = 0.618*AB and CD = 1.618*AB , as you can see this condition is based on 0.618 which is a ratio in the Fibonacci sequence. Other conditions are for AB to equal to CD or for CD to be 161.8% longer than AB. Why these conditions ? Cause Fibonacci of course .
The ABCD pattern that the proposed tool aim to detect is not based on the zig-zag but only on individual price observations and don't make use of any of the previously described conditions, thus becoming more like a candle pattern.
When the label is blue it means that the tool has detected a bullish ABCD pattern, while a red label means that the tool has detected a bearish ABCD pattern.
We can't expect patterns based on the analysis of 1,2,3 or 4 closing price observations to predict the reversal of mid/long term movements, this can be seen on the above chart, but we can see some signals predicting short term movements.
Since the pattern is based on a noisy variation, using smoother input can result in less signals.
Above the tool on BTCUSD using closing price as input. Below the tool using ohlc4 as input:
TOOL OPTIONS
Being to early can be as devastating as being to late, therefore a confirmation point can be beneficial, the tool allow you to wait for confirmation thus having a potentially better timing. Below is a chart of AMD with no confirmation:
As we can see there are many signals with some of them occurring to early, we can fix this by checking the confirmation option:
The confirmation is simply based on the candle color, for example if a bearish ABCD pattern has been detected in the past and the closing price is greater than the opening price then the tool return a buy signal. The same apply with a bearish ABCD pattern.
The "last bar repaint" option is true by default, this in order to show the bar where the D point of the pattern has been detected, since the closing price of the last bar is constantly changing the signals on the last bar can be constantly appearing/disappearing, unchecking the option will fix this but will no longer the bar where the D point of the pattern has been detected.
SUMMARY
The pattern is simple and can sometimes be accurate when predicting the direction of future short terms movements. The tool was a request, as it seems i don't post many pattern detectors, well thats true, and the reason is that for me patterns are not super significant, and their detection can be extremely subjective, this is why simple patterns are certainly the only ones worth a look.
Don't expect me to post many pattern related indicators in the future ^^'
Sequentially Filtered Moving AverageThe previously proposed sequential filter aimed to filter variations lower than a certain period, this allowed to remove noisy variations and retain only the closing price values that occurred after a consecutive up/down, however because of the noisy nature of the closing price large filtering was impossible, in order to tackle to this problem the same indicator using a simple moving average as input is proposed, this allow for smoother results.
We will see that the proposed indicator can provide an alternative moving average that could be used as slow moving average in crossover systems.
The Indicator
The length parameter as the same function as the one described in the sequential filter post, however here length also control the period of the moving average used input, in short larger values of length will return a smoother but less reactive output.
In blue the moving average with length = 200, and in red the moving average with length = 50.
It is interesting to see how the moving average remain flat during ranging/flat market periods
Unfortunately like the sequential filter the sequentially filtered moving average (SFMA) is not affected by large short term variations such as gaps or short term volatile events. This is because of the nature of the sequential filter to ignore movements amplitude and only focus on the variation period.
Moving Average Crossover System
The SFMA is equal to a simple moving average of period length when a consecutive up/down sequence of size length has occurred, else the SFMA is equal to its precedent value, therefore we could expect less crosses between a fast moving average and the SFMA as slow moving average.
We can see on the figure above that the fast moving average of period 50 (in green) cross more with the slow moving average of period 200 (in red) than with the SFMA of period 200 (in blue).
Crosses can occur at the same time as with the classical slow moving average (in red) or a bit later.
Conclusion
A new moving average based on the recently proposed sequential filter has been proposed, it can be seen that under a moving average crossover system the proposed moving average seems to be more effective at producing less crosses without necessarily doing it with an excessive lag, in fact the moving average has either lag (length-1)/2 or lag length .
In the future it could be interesting to provide an hybrid alternative that take into account volatility as well as variations period.
Thanks for reading !
Sequential Filter - An Original Filtering ApproachRemoving irregular variations in the closing price remain a major task in technical analysis, indicators used to this end mostly include moving averages and other kind of low-pass filters. Understanding what kind of variations we want to remove is important, irregular (noisy) variations have mostly a short term period, fully removing them can be complicated if the filter is not properly selected, for example we might want to fully remove variations with a period of 2 bars and lower, if we select an arithmetic moving average the filter output might still contain such variations because of the ripples in the frequency response passband, all it would take is a variation of high amplitude for that variation to be clearly visible.
Although all it would take for better filtering is a filter with better performance in the frequency domain (gaussian, Butterworth, Bessel...) we can design innovative approaches that does not rely on the model of classical moving averages, today a new technical indicator is proposed, the technical indicator fully remove variations lower than the selected period.
The Indicator Approach
In order for the indicator output to change the closing price need to produce length consecutive up's/down's, length control the variation threshold of the indicator, variations lower than length are fully removed. Lets see a visual example :
Here length = 3, the closing price need to make 3 consecutive up's/down's, when the sequence happen the indicator output is equal to src , here the closing price, else the indicator is equal to its precedent value, hence removing other variations. The value of 3 is the value by default, this is because i have seen in the past that the average smallest variations period where in general of 3 bars.
Because the indicator focus only on the variation sign, it totally ignore the amplitude of the movement, this provide an effective way to filter short term retracement in a fluctuation as show'n below :
The candle option of the indicator allow the indicator to only focus on the body color of a candle, thus ignoring potential gaps, below is an example with the candle option off :
If we activate the "candle" option we end up with :
Note that the candle option is based on the closing and opening price, if you use the indicator on another indicator output make sure to have the candle option off.
Length and Indicator Color
The closing price is infected by noise, and will rarely make a large sequence of consecutive up's/down's, the indicator can therefore be useful to detect consecutive sequence of length period, here 6 is selected on BTCUSD :
A consecutive up's/down's of period 6 can be considered a relatively rare event.
It is important to note that the color of the indicator used by default has nothing to do with the consecutive sequence detected, that is the indicator turning red doesn't necessarily mean that a consecutive down's sequence has occurred, but only that this sequence has occurred at a lower value than the precedent detected sequence. This is show'n below :
In order to make the indicator color based on the detected sequence check the "Color Based On Detected Sequence" option.
Conclusion
An original approach on filtering price variations has been proposed, i believe the indicator code is elegant as well as relatively efficient, and since high values of length can't really be used the indicator execution speed will remain relatively fast.
Thanks for reading !
BEST ABCD Pattern ScreenerHello ladies and gentlemen traders
Continuing deeper and stronger with the screeners' educational series one more time.
This one is heavy crazy mega cool (pardon my french).
I - Concept
I present to you, ladies and gentlemen, the first screener for harmonic patterns.
Starting with an ACBD pattern screener this time!!
I used the calculations from Ricardo Santo's script
In short, he's using fractals (regular or Bill Williams ) for the pattern calculations. A masterpiece !!!
The screener will show in 1 consolidated chart the ABCD patterns for 5 selected assets. Could be stocks, forex, crypto, whatever you feel like making money with
II - Definitions
The ABCD pattern ( AB=CD ) is one of the classic chart patterns which is repeated over and over again.
The ABCD pattern shows perfect harmony between price and time.
More info here
The Williams Fractal is an indicator, developed by Bill Williams, that aims to detect reversal points (highs and lows) and marks them with arrows.
Up fractals and down fractals have specific shapes. The Williams Fractal indicator helps users determine in which direction price will develop
Source: www.tradingview.com
III - How did I set the screener
The visual signals are as follow:
- square: whenever there is an ABCD pattern detected
Then the colors are:
- green when a bullish pattern is detected
- red when a bearish pattern is detected
🔸 The script screenshot shows two red squares matching two ABCD bearish pattern from the above panel. As the chart is showing APPL, I highlighted where the screener mentioned the fruit stock ( APPLE, pun, bad joke, Dave out...)
🔸 I tried to make it as clear as I could with red arrows
Once again, we pushed together the limits of pine script beyond of what we thought was possible, beyond the realm of this world, reaching finally the dreamt pine script heaven (am I going too far? feel free to tell me)
Best regards,
Dave
[RS]ZigZag Percent Reversal - Helper - Draw Patterns - Part 3Helper script to draw patterns on chart.
[RS]ZigZag Percent Reversal - Helper - Draw Patterns - Part 2Helper script to display patterns on chart.
[RS]ZigZag Percent Reversal - Helper - Draw Patterns - Part 1Helper script to display patterns on chart.