RSI Primed [ChartPrime]
RSI Primed combines candlesticks, patterns, and the classic RSI indicator for advanced market trend indications
Introduction
Technical traders are always looking for innovative methods to pinpoint potential entry and exit points in the market. The RSI Prime indicator provides such traders with an enhanced view of market conditions by combining various charting styles and the Relative Strength Index (RSI). It offers users a unique perspective on the market trends and price momentum, enabling them to make better-informed decisions and stay ahead of the market curve.
The RSI Primed is a versatile indicator that combines different charting styles with the Relative Strength Index (RSI) to help traders analyze market trends and price momentum. It offers multiple visualization modes that serve specific purposes and provide unique insights into market performance:
Regular Candlesticks
Candlesticks with Patterns
Heikin Ashi Candles
Line Style
Regular Candlestick Mode
The Regular Candlestick Mode in RSI Primed depicts traditional Japanese candlesticks that most traders are familiar with. This mode bypasses any smoothing or modified calculations, representing real-price movements. Regular candlesticks offer a clear and straightforward way to visualize market trends and price action.
Candlestick with Patterns Mode
The Candlestick with Patterns Mode focuses on identifying high-probability candlestick patterns while incorporating RSI values. By leveraging the information captured by the RSI, this mode allows traders to spot significant market reversals or continuation patterns that could signal potential trading opportunities. Some recognizable patterns include engulfing bullish, engulfing bearish, morning star bullish, and evening star bearish patterns.
Heikin Ashi Candles Mode
The Heikin Ashi Candles Mode presents an advanced candlestick charting technique known for its excellent trend-following capabilities. Heikin Ashi Candles filter out noise in the market and provide a clear representation of market trends. In this mode, candlesticks are plotted based on RSI values of the open, high, low, and close prices, helping traders understand and utilize market trends effectively.
Line Style Mode
The Line Style Mode offers a simpler and minimalistic representation of the RSI values by using a line instead of candlesticks to visualize market trends. This mode helps traders focus on the overall trend direction and eliminates potential distractions caused by the complexity of candlestick patterns.
Candle Color Overlay Mode
The Candle Color Overlay Mode is a unique feature in the RSI Primed indicator that allows traders to visualize the RSI values on the chart's candles as a heat gradient. This mode adds a color overlay to the candlesticks, representing the RSI values in relation to the candlesticks' price action.
By displaying the RSI as a color gradient, traders can quickly assess market momentum and identify overbought or oversold conditions without having to switch between different modes or charts. The gradient ranges from cool colors (blue and green) for lower RSI values, indicating oversold conditions, to warm colors (orange and red) for higher RSI values, signifying overbought situations.
To enable the Candle Color Overlay Mode, traders can toggle the "Color Candles" option in the indicator settings. Once enabled, the color gradient will be applied to the candlesticks on the chart, providing a visually striking and informative representation of the RSI values in relation to price action. This mode can be used in tandem with any of the other charting styles, allowing traders to gain even more insights into market trends and momentum.
RSI Primed Implementation
The RSI Primed indicator combines the benefits of various charting styles with the RSI to help traders gain a comprehensive view of market trends and price momentum. It incorporates the Heikin Ashi and RSI values as inputs to generate several visualization modes, enabling traders to select the one that best suits their needs.
Chebyshev Digital Audio Filter in RSI Primed Indicator
A unique feature of the RSI Primed Indicator is the incorporation of the Chebyshev Digital Audio Filter, a powerful tool that significantly influences the indicator's accuracy and responsiveness. This signal processing method brings several benefits to the context of the RSI indicator, improving its performance and capabilities.
1. Improved Signal Filtering
The Chebyshev filter excels in its ability to remove high-frequency noise and unwanted signals from the RSI data. While other filtering techniques might introduce unwanted side effects or distort the RSI data, the Chebyshev filter accurately retains the main signal components, enhancing the RSI Primed's overall accuracy and reliability.
2. Faster Response Time
The Chebyshev filter offers a faster response time than most other filtering techniques. In the context of the RSI Primed Indicator, this means that the filtering process is quicker and more efficient, allowing traders to act swiftly during rapidly changing market conditions.
3. Enhanced Trend Detection
By effectively removing noise from the RSI data, the Chebyshev filter contributes to the enhanced detection of underlying market trends. This feature helps traders identify potential entry and exit points more accurately, improving their overall trading strategy and performance.
How to Use RSI Primed
Traders can choose from different visualization modes to suit their preferences while using the RSI Primed indicator. By closely monitoring the chosen visualization mode and the position of the moving average, traders can make informed decisions about market trends.
Green candlesticks or an upward line slope indicate a bullish trend, and red candlesticks or a downward line slope suggest a bearish trend. If the candles or line are above the moving average, it could signify an uptrend, whereas a position below the moving average may indicate a downtrend.
The RSI Primed indicator offers a unique and comprehensive perspective on market trends and price momentum by combining various charting styles with the RSI. Traders can choose from different visualization modes and make well-informed decisions to capitalize on market opportunities. This innovative indicator provides a clear and concise view of the market, enabling traders to make swift decisions and enhance their trading results.
Candlestickpattern
The Golden Candlestick PatternThe Golden pattern is a three-candlestick configuration based on a variation of the golden ratio (2.618) from the Fibonacci sequence.
The bullish Golden pattern is composed of a normal bullish candlestick with any type of body, followed by a bigger bullish candlestick with a close price that is at least 2.618 times the size of the first candlestick (high to low). Finally, there must be an important condition that is, a third candlestick that comes back to test the open of the second candlestick from where the entry is given.
The bearish Golden pattern is composed of a normal bearish candlestick with any type of body, followed by a bigger bearish candlestick with a close price that is at least 2.618 times the size of the first candlestick (high to low). Finally, there must be an important condition that is, a third candlestick that comes back to test the open of the second candlestick from where the entry is given.
CandlesticksIndicator that identifies the classical candlestick patterns for markets that are open 24/7 like the crypto market.
Why? because those markets don't gap, so many patterns won't need to gap to be valid.
Also, the theoretical rules about the patterns are very strict but it is to the discretion of the trader or technical analyst to decide if the patterns are yet valid. This is how Steve Nison uses candlesticks, i.e. a hammer is still valid if it has a small upper shadow, a marubozu is still valid if it has tiny shadows, etc.
So, for each candlestick pattern there are tolerance parameters so you can decide what is an acceptable upper shadow size for a hammer etc. I have set them to my liking but you might want to adjust them which is totally fine.
Additional features:
-to avoid the clutter, decide how many candles have to be analyzed
-use a trend filter based on the ema 5 (you can change the value) so you only see reversal patterns relevant to the trend
-plot pivots (swings HL)
-volume confirmation: bearish signals don't need volume confirmation as prices fall off their own weight. But volume confirmation for bullish price action can serve as added confluence. You have a setting that allows you to decide how many times the volume needs to be bigger than the previous candle's volume : if you have a bullish candlestick pattern printed, if the volume is1.5 times bigger than the previous candle then you will have a shape plotted at the bottom of your chart
-there is a cheap vs expensive feature that colors the bars
-you can also color the background so you see the oversold/overbought RSI
-finally, there are a couple of custom signals
"RULES" ABOUT CANDLESTICKS
-this is not a system in itself, but combined with other candlesticks (cluster of candlesticks), volume, oscillators, trend lines, support and resistances, bollinger bands can give amazing results and that is where the magic is
-most candlesticks can establish a support or resistance or confirm one
-a reversal candlestick doesn't mean that market will shoot the other direction right away, trend changes occur usually slowly and the trend might not reverse but convert in a period of sideways. It shouldn't actually be named reversal patterns but rather trend change patterns.
-reversal patterns need a trend to reverse (or change), in ranging markets you should ignore the signals
-you might think that there are many false signals, you need to understand that they are early warnings and the next candle's close is of major importance. A hammer at the end of a downtrend isn't enough to enter a position, you will have to wait for the next candle to close above the high of the hammer to validate the bullish reversal and vice versa.
-some signals are based on 1 candle only (like the hammer) others on 2 candles (like the engulfing pattern), others on 3 and more (tower top, morning star, etc). Patterns based on multiple candles have more probability.
-you might want to wait for price to revisit the support created by the pattern (read below) to get a better entry
-candles do not provide price targets
-long lower shadows is bullish, long upper shadows is bearish, small bodies (spinning tops, stars, dojis) means indecision and market is vulnerable to a trend change and the color of the body is irrelevant, declining size of bodies means trend strength weakening
HAMMER
stop-loss under the lower shadow
lower shadow can become a potential support or confirm an existing support
ENGULFING
with bearish engulfing pattern use the highest high of the 2 candles as a resistance, and with bullish engulfing pattern use the lowest low as support
DARK CLOUD COVER
use the highest high of the 2 candles as resistance
PIERCING PATTERN
use the lowest low of the 2 candles as support
MORNING STAR
use the lowest low of the 3 candles as support
the smaller the body of the 2nd candle the more potent the signal
for traditional markets, an ideal morning star would have a gap between 2nd and 3rd candles' bodies
EVENING STAR
use the highest high of the 3 candles as resistance
the smaller the body of the 2nd candle the more potent the signal
HARAMI
the smaller the size of the candle the more potent the signal
TWEEZERS
very important signals by themselves on weekly and monthly charts
for daily and intraday signals, it is potent only if it meets additional criterias (1st candle long, 2nd short, a candle pattern with with same highs or lows)
BELT-HOLD
they are more important if they confirm a support or resistance or another belt-hold or if they have not appeared for a while.
3 BLACK CROWS AND 3 WHITE SOLDIERS
candles 1 and 2 should act as support for the 3WS and as resistance for the 3BC
RISING AND FALLING 3 METHODS
stop-loss is the low of the 1st candle that started the rising 3 methods
stop-loss is the high of the 1st candle that started the falling 3 methods
ideally 1st and last candles have the strongest volume
DOJI
signal is reinforced by subsequent candles, if market is oversold or overbought, if the market doesn't have many doji on the chart, if market is at an important junction, if there are other technical alerts
doji after a tall candle are especially potent, the highest high of the 2 candles is the resistance
doji are especially potent after an uptrend, less so after a downtrend
gavestone doji is a bearish signal
dragonfly doji is a bullish signal
long-legged doji is a confused market
CUSTOM
*1st signal is a continuation pattern based on the progression of bodies' sizes and/or shadows' sizes
*following ones are reversal patterns based on the progression of bodies' sizes and/or shadows' sizes
*early reversal is based on a "secret" excess signal
reversal confirmed is when the early reversal's excess resolves and price reintegrates the non-excess area + prints a custom reversal pattern
for both early reversal and reversal confirmed the same rule applies as with any candlestick signal: we wait for the next candle's close above the previous upper shadow (bullish reversal) or below the previous lower shadow (bearish reversal)
*swings are 3 candles fractals, they are not reversal or continuation patterns but serve to mark swing highs and lows
this is all based on Steve Nison's book Japanese candlestick charting techniques
and
Thomas N. Bulkowski's Encyclopedia of candlestick charts
5m Candle OverlayDescription:
The 5m Candle Overlay indicator is a powerful technical analysis tool designed to overlay 5-minute candles onto your chart. This indicator enables detailed analysis of price action within the 5-minute time frame, providing valuable insights into short-term market movements.
How it Works:
The 5m Candle Overlay indicator calculates the OHLC (Open, High, Low, Close) values specifically for the 5-minute time frame. By utilizing the request.security function, it retrieves the OHLC values for each 5-minute candle. The indicator then determines the color for each candle based on a comparison between the close and open prices. Bullish candles are assigned a green color with 75% opacity, while bearish candles are assigned a red color with 75% opacity. Additionally, the indicator checks if the current bar index is a multiple of 5 to prevent overlapping and enhance visualization.
Usage:
To effectively utilize the 5m Candle Overlay indicator, follow these steps:
1. Apply the 5m Candle Overlay indicator to your chart by adding it from the available indicators.
2. Observe the overlay of 5-minute candles on your chart, providing a detailed representation of price movements within the 5-minute time frame.
3. Interpret the candles:
- Bullish candles (green by default) indicate that the close price is higher than the open price, suggesting potential buying pressure.
- Bearish candles (red by default) indicate that the close price is lower than the open price, suggesting potential selling pressure.
4. Note that the indicator plots candles with a vertical offset every fifth indicator to prevent overlapping, ensuring clarity and ease of interpretation.
5. Combine the analysis of the 5-minute candles with other technical analysis tools, such as support and resistance levels, trend lines, or indicators from different time frames, to gain deeper insights and identify potential trade setups.
6. Implement appropriate risk management strategies, including setting stop-loss orders and position sizing, to effectively manage your trades within the 5-minute time frame and protect your capital.
luckynickva OHLC
This Script Shows The OHLC Of The Higher Timeframe Candles In The Background Great For Not Losing Sight Of The Bigger Picture On The Lower Timeframe
Pattern Forecast (Expo)█ Overview
The Pattern Forecast indicator is a technical analysis tool that scans historical price data to identify common chart patterns and then analyzes the price movements that followed these patterns. It takes this information and projects it into the future to provide traders with potential price actions that may occur if the same pattern is identified in real-time market data. This projection helps traders to understand the possible outcomes based on the previous occurrences of the pattern, thereby offering a clearer perspective of the market scenario. By analyzing the historical data and understanding the subsequent price movements following the appearance of a specific pattern, the indicator can provide valuable insights into potential future market behavior.
█ Calculations
The indicator works by scanning historical price data for various candlestick patterns. It includes all in-built TradingView patterns, credit to TradingView that has coded them.
Essentially, the indicator takes the historical price moves that followed the pattern to forecast what might happen next.
█ Example
In this example, the algorithm is set to search for the Inverted Hammer Bullish candlestick pattern. If the pattern is found, the historical outcome is then projected into the future. This helps traders to understand how the past pattern evolved over time.
█ How to use
Providing traders with a comprehensive understanding of historical patterns and their implications for future price action allows them to assess the likelihood of specific market scenarios objectively. For example, suppose the pattern forecast indicator suggests that a particular pattern is likely to lead to a bullish move in the market. A trader might consider going long if the same pattern is identified in the real-time market. Similarly, a trader might consider shorting the asset if the indicator suggests a bearish move is likely, if the same pattern is identified in the real-time market.
█ Settings
Pattern
Select the pattern that the indicator should scan for. All inbuilt TradingView patterns can be selected.
Forecast Candles
Number of candles to project into the future.
-----------------
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!
PivotBoss Tool (PART 2)Hello Everyone,
This indicator is being published on TradingView to help traders solve their multiframe EOD analysis issue and at the same time get additional information of other crucial information - CandleStick Patterns, Candlestick Midpoint and ATR Trails for trailing your SL's all under one single frame.
This indicator is based on the concepts of Secrets of Pivot Boss by Mr.Frank Ochoa and strives to provide more insightful information of pivot points and other general indicators being used by traders on day-to-day basis in the simplest format possible so that traders of all kinds can relate to the same.
And, this is purely dedicated to EOD analysis.
What is the moat of this Indicator?
This particular indicator is designed to help the traders in their EOD analysis as this indicator is well equipped to provide the next session trading pivot points well in advance at the end of the current day trading session. A trader has everything required for an EOD analysis in this particular indicator.
Below is the brief information of the indicator table you see in the layout of the above chart -
#Next Session Pivots
One can plot this feature to find out the developing pivot levels for upcoming D/W/M/Q/Y alongside it's additional pivot levels such as:
- Future Camarilla Pivots (H3/H4/H5 & L3/L4/L5)
- Future Floor Pivots (R1/R2/R3 & S1/S2/S3)
- Future CPR levels (TC/PIVOT/BC)
#Developing Pivot Cloud
One can check the developing CPR in Intraday itself by enabling the pivot cloud feature which can tell you multiple information to be with the trend and it's participants.
Basically a live extension of the current trading CPR according with the progress of the trading day.
#CandleStick Mid-Point
This can plot the midpoint of each candlestick on any timeframe for better understanding of buyer/seller's absorption!
#Candlestick Pattern Scans
So one can now easily filter out the candlesticks patterns which helps in decoding the chart in a better format for entry and exits. There are 4 candlesticks patterns included -
- Wick Reversal Pattern -
This pattern basically tells the wick strength which is actually a liquidity absorption by the stronger hand and the intensity and further direction of the move depends on the position of wick candle being formed indicated by green (bull) or red (bear) signal.
- Doji Reversal Pattern -
This pattern basically is used to identify the biasness of the market participants and further identifies a pause in the ongoing trend or a pause for the trend to get further liquidity for broader strength.
- Outside Reversal Pattern -
This pattern depicts the range of the previous candle of a specific timeframe has been tested at both the extreme and probably the price will consolidate in the that visible range for a while.
- Extreme Reversal Pattern -
This pattern basically points at a setup that looks for an extreme pattern of selling pressure and then looks to fade this behavior to capture a bullish move higher (reverse for shorts) and vice versa .
#ATR Trails
This a just a supertrend indicator sourced with ATR to track a short/long term trend change and can be used for trailing SL's when they are kept tight for big positions!
#CPR Trails
This is the most interesting feature with multiple permutations & combinations and can be used to analyse intraday as well as EOD and positional trends. Moreover, THIS FEATURE CAN ALSO INDENTIFY MICRO INTRADAY TREND AS SMALL AS EACH 5M TREND!!
This indicator will be updated with time and depending on community's feedback and requirements.
Credits -
- Mr. Frank Ochoa (Concepts and ideas from the book 'Secrets of PivotBoss' )
- TradingView (Providing a platform to traders to simply their trading through 'PineScript')
Regards,
Mukkull
Crypto Uptrend Script + Pullback//Volume CandlesDescription: his is an adaption of my Pullback candle - This works on all timeframes and Markets (Forex//Stocks//)
Crypto Uptrend Script with Pullback Candle allows traders to get into a trend when the price is at end of a pullback and entering a balance phase in the market (works on all markets). The use of Moving averages to help identify a Trends and the use of Key levels to help traders be aware of where strong areas are in the market.
This script can work really well in Crypto Bull Runs when used on HTF and with confluences
The script has key support and resistance zones which are made up of quarterly data. Price reacts to these areas but patience is required as price will take time to come into these areas
I have updated the Pullback Candle with the use of Volume to filter out the weak Pullback Candles -
There are new candles to the script.
The First candle is the Bullish Volume Candle - This candle is set to a multiplier of 2x with a crossover of 50/100 on Volume - this then will paint a purple candle.
Uses of the Bullish Volume Candle:
Breakthrough of key areas // special chart patterns
Rejection of key areas
End of a impulse wave (Profit Takers)
The second candle is a Hammer - I prefer using the Hammers on Higher Timeframes however they do work on all timeframes. .
The third candle is a Exhaustion of impulse downward move.
Uses of this candle - can denote a new trend but has to be with confluence to a demand area // support area or with any use of technical analysis - using this alone is not advised
The fourth candle is a indecision candle in the shape of a Doji - this candle can help identify if the trend is in a continuation or a reversal
This script can work really well in Crypto Bull Runs
Disclaimer: There will be Pullbacks with High Volume (Breakouts) and not go the way as intended but this script is to allow traders to get into trends at good price levels. The script can paint signals in areas where price is too expensive so please do your own due diligence on the markets as this script is to help get into good areas of price
Please leave a thumbs up if you like this script and message me for information on how to use the script.
Adaptive Candlestick Pattern Recognition System█ INTRODUCTION
Nearly three years in the making, intermittently worked on in the few spare hours of weekends and time off, this is a passion project I undertook to flesh out my skills as a computer programmer. This script currently recognizes 85 different candlestick patterns ranging from one to five candles in length. It also performs statistical analysis on those patterns to determine prior performance and changes the coloration of those patterns based on that performance. In searching TradingView's script library for scripts similar to this one, I had found a handful. However, when I reviewed the ones which were open source, I did not see many that truly captured the power of PineScrypt or leveraged the way it works to create efficient and reliable code; one of the main driving factors for releasing this 5,000+ line behemoth open sourced.
Please take the time to review this description and source code to utilize this script to its fullest potential.
█ CONCEPTS
This script covers the following topics: Candlestick Theory, Trend Direction, Higher Timeframes, Price Analysis, Statistic Analysis, and Code Design.
Candlestick Theory - This script focuses solely on the concept of Candlestick Theory: arrangements of candlesticks may form certain patterns that can potentially influence the future price action of assets which experience those patterns. A full list of patterns (grouped by pattern length) will be in its own section of this description. This script contains two modes of operation for identifying candlestick patterns, 'CLASSIC' and 'BREAKOUT'.
CLASSIC: In this mode, candlestick patterns will be identified whenever they appear. The user has a wide variety of inputs to manipulate that can change how certain patterns are identified and even enable alerts to notify themselves when these patterns appear. Each pattern selected to appear will have their Profit or Loss (P/L) calculated starting from the first candle open succeeding the pattern to a candle close specified some number of candles ahead. These P/L calculations are then collected for each pattern, and split among partitions of prior price action of the asset the script is currently applied to (more on that in Higher Timeframes ).
BREAKOUT: In this mode, P/L calculations are held off until a breakout direction has been confirmed. The user may specify the number of candles ahead of a pattern's appearance (from one to five) that a pattern has to confirm a breakout in either an upward or downward direction. A breakout is constituted when there is a candle following the appearance of the pattern that closes above/at the highest high of the pattern, or below/at its lowest low. Only then will percent return calculations be performed for the pattern that's been identified, and these percent returns are broken up not only by the partition they had appeared in but also by the breakout direction itself. Patterns which do not breakout in either direction will be ignored, along with having their labels deleted.
In both of these modes, patterns may be overridden. Overrides occur when a smaller pattern has been detected and ends up becoming one (or more) of the candles of a larger pattern. A key example of this would be the Bearish Engulfing and the Three Outside Down patterns. A Three Outside Down necessitates a Bearish Engulfing as the first two candles in it, while the third candle closes lower. When a pattern is overridden, the return for that pattern will no longer be tracked. Overrides will not occur if the tail end of a larger pattern occurs at the beginning of a smaller pattern (Ex: a Bullish Engulfing occurs on the third candle of a Three Outside Down and the candle immediately following that pattern, the Three Outside Down pattern will not be overridden).
Important Functionality Note: These patterns are only searched for at the most recently closed candle, not on the currently closing candle, which creates an offset of one for this script's execution. (SEE LIMITATIONS)
Trend Direction - Many of the patterns require a trend direction prior to their appearance. Noting TradingView's own publication of candlestick patterns, I utilize a similar method for determining trend direction. Moving Averages are used to determine which trend is currently taking place for candlestick patterns to be sought out. The user has access to two Moving Averages which they may individually modify the following for each: Moving Average type (list of 9), their length, width, source values, and all variables associated with two special Moving Averages (Least Squares and Arnaud Legoux).
There are 3 settings for these Moving Averages, the first two switch between the two Moving Averages, and the third uses both. When using individual Moving Averages, the user may select a 'price point' to compare against the Moving Average (default is close). This price point is compared to the Moving Average at the candles prior to the appearance of candle patterns. Meaning: The close compared to the Moving Average two candles behind determines the trend direction used for Candlestick Analysis of one candle patterns; three candles behind for two candle patterns and so on. If the selected price point is above the Moving Average, then the current trend is an 'uptrend', 'downtrend' otherwise.
The third setting using both Moving Averages will compare the lengths of each, and trend direction is determined by the shorter Moving Average compared to the longer one. If the shorter Moving Average is above the longer, then the current trend is an 'uptrend', 'downtrend' otherwise. If the lengths of the Moving Averages are the same, or both Moving Averages are Symmetrical, then MA1 will be used by default. (SEE LIMITATIONS)
Higher Timeframes - This script employs the use of Higher Timeframes with a few request.security calls. The purpose of these calls is strictly for the partitioning of an asset's chart, splitting the returns of patterns into three separate groups. The four inputs in control of this partitioning split the chart based on: A given resolution to grab values from, the length of time in that resolution, and 'Upper' and 'Lower Limits' which split the trading range provided by that length of time in that resolution that forms three separate groups. The default values for these four inputs will partition the current chart by the yearly high-low range where: the 'Upper' partition is the top 20% of that trading range, the 'Middle' partition is 80% to 33% of the trading range, and the 'Lower' partition covers the trading range within 33% of the yearly low.
Patterns which are identified by this script will have their returns grouped together based on which partition they had appeared in. For example, a Bullish Engulfing which occurs within a third of the yearly low will have its return placed separately from a Bullish Engulfing that occurred within 20% of the yearly high. The idea is that certain patterns may perform better or worse depending on when they had occurred during an asset's trading range.
Price Analysis - Price Analysis is a major part of this script's functionality as it can fundamentally change how patterns are shown to the user. The settings related to Price Analysis include setting the number of candles ahead of a pattern's appearance to determine the return of that pattern. In 'BREAKOUT' mode, an additional setting allows the user to specify where the P/L calculation will begin for a pattern that had appeared and confirmed. (SEE LIMITATIONS)
The calculation for percent returns of patterns is illustrated with the following pseudo-code (CLASSIC mode, this is a simplified version of the actual code):
type patternObj
int ID
int partition
type returnsArray
float returns
// No pattern found = na returned
patternObj TEST_VAL = f_FindPattern()
priorTestVal = TEST_VAL
if not na( priorTestVal )
pnlMatrixRow = priorTestVal.ID
pnlMatrixCol = priorTestVal.partition
matrixReturn = matrix.get(PERCENT_RETURNS, pnlMatrixRow, pnlMatrixCol)
percentReturn = ( (close - open ) / open ) * 100%
array.push(matrixReturn.returns, percentReturn)
Statistic Analysis - This script uses Pine's built-in array functions to conduct the Statistic Analysis for patterns. When a pattern is found and its P/L calculation is complete, its return is added to a 'Return Array' User-Defined-Type that contains numerous fields which retain information on a pattern's prior performance. The actual UDT is as follows:
type returnArray
float returns = na
int size = 0
float avg = 0
float median = 0
float stdDev = 0
int polarities = na
All values within this UDT will be updated when a return is added to it (some based on user input). The array.avg , array.median and array.stdev will be ran and saved into their respective fields after a return is placed in the 'returns' array. The 'polarities' integer array is what will be changed based on user input. The user specifies two different percentages that declare 'Positive' and 'Negative' returns for patterns. When a pattern returns above, below, or in between these two values, different indices of this array will be incremented to reflect the kind of return that pattern had just experienced.
These values (plus the full name, partition the pattern occurred in, and a 95% confidence interval of expected returns) will be displayed to the user on the tooltip of the labels that identify patterns. Simply scroll over the pattern label to view each of these values.
Code Design - Overall this script is as much of an art piece as it is functional. Its design features numerous depictions of ASCII Art that illustrate what is being attempted by the functions that identify patterns, and an incalculable amount of time was spent rewriting portions of code to improve its efficiency. Admittedly, this final version is nearly 1,000 lines shorter than a previous version (one which took nearly 30 seconds after compilation to run, and didn't do nearly half of what this version does). The use of UDTs, especially the 'patternObj' one crafted and redesigned from the Hikkake Hunter 2.0 I published last month, played a significant role in making this script run efficiently. There is a slight rigidity in some of this code mainly around pattern IDs which are responsible for displaying the abbreviation for patterns (as well as the full names under the tooltips, and the matrix row position for holding returns), as each is hard-coded to correspond to that pattern.
However, one thing I would like to mention is the extensive use of global variables for pattern detection. Many scripts I had looked over for ideas on how to identify candlestick patterns had the same idea; break the pattern into a set of logical 'true/false' statements derived from historically referencing candle OHLC values. Some scripts which identified upwards of 20 to 30 patterns would reference Pine's built-in OHLC values for each pattern individually, potentially requesting information from TradingView's servers numerous times that could easily be saved into a variable for re-use and only requested once per candle (what this script does).
█ FEATURES
This script features a massive amount of switches, options, floating point values, detection settings, and methods for identifying/tailoring pattern appearances. All modifiable inputs for patterns are grouped together based on the number of candles they contain. Other inputs (like those for statistics settings and coloration) are grouped separately and presented in a way I believe makes the most sense.
Not mentioned above is the coloration settings. One of the aims of this script was to make patterns visually signify their behavior to the user when they are identified. Each pattern has its own collection of returns which are analyzed and compared to the inputs of the user. The user may choose the colors for bullish, neutral, and bearish patterns. They may also choose the minimum number of patterns needed to occur before assigning a color to that pattern based on its behavior; a color for patterns that have not met this minimum number of occurrences yet, and a color for patterns that are still processing in BREAKOUT mode.
There are also an additional three settings which alter the color scheme for patterns: Statistic Point-of-Reference, Adaptive coloring, and Hard Limiting. The Statistic Point-of-Reference decides which value (average or median) will be compared against the 'Negative' and 'Positive Return Tolerance'(s) to guide the coloration of the patterns (or for Adaptive Coloring, the generation of a color gradient).
Adaptive Coloring will have this script produce a gradient that patterns will be colored along. The more bullish or bearish a pattern is, the further along the gradient those patterns will be colored starting from the 'Neutral' color (hard lined at the value of 0%: values above this will be colored bullish, bearish otherwise). When Adaptive Coloring is enabled, this script will request the highest and lowest values (these being the Statistic Point-of-Reference) from the matrix containing all returns and rewrite global variables tied to the negative and positive return tolerances. This means that all patterns identified will be compared with each other to determine bullish/bearishness in Adaptive Coloring.
Hard Limiting will prevent these global variables from being rewritten, so patterns whose Statistic Point-of-Reference exceed the return tolerances will be fully colored the bullish or bearish colors instead of a generated gradient color. (SEE LIMITATIONS)
Apart from the Candle Detection Modes (CLASSIC and BREAKOUT), there's an additional two inputs which modify how this script behaves grouped under a "MASTER DETECTION SETTINGS" tab. These two "Pattern Detection Settings" are 'SWITCHBOARD' and 'TARGET MODE'.
SWITCHBOARD: Every single pattern has a switch that is associated with its detection. When a switch is enabled, the code which searches for that pattern will be run. With the Pattern Detection Setting set to this, all patterns that have their switches enabled will be sought out and shown.
TARGET MODE: There is an additional setting which operates on top of 'SWITCHBOARD' that singles out an individual pattern the user specifies through a drop down list. The names of every pattern recognized by this script will be present along with an identifier that shows the number of candles in that pattern (Ex: " (# candles)"). All patterns enabled in the switchboard will still have their returns measured, but only the pattern selected from the "Target Pattern" list will be shown. (SEE LIMITATIONS)
The vast majority of other features are held in the one, two, and three candle pattern sections.
For one-candle patterns, there are:
3 — Settings related to defining 'Tall' candles:
The number of candles to sample for previous candle-size averages.
The type of comparison done for 'Tall' Candles: Settings are 'RANGE' and 'BODY'.
The 'Tolerance' for tall candles, specifying what percent of the 'average' size candles must exceed to be considered 'Tall'.
When 'Tall Candle Setting' is set to RANGE, the high-low ranges are what the current candle range will be compared against to determine if a candle is 'Tall'. Otherwise the candle bodies (absolute value of the close - open) will be compared instead. (SEE LIMITATIONS)
Hammer Tolerance - How large a 'discarded wick' may be before it disqualifies a candle from being a 'Hammer'.
Discarded wicks are compared to the size of the Hammer's candle body and are dependent upon the body's center position. Hammer bodies closer to the high of the candle will have the upper wick used as its 'discarded wick', otherwise the lower wick is used.
9 — Doji Settings, some pulled from an old Doji Hunter I made a while back:
Doji Tolerance - How large the body of a candle may be compared to the range to be considered a 'Doji'.
Ignore N/S Dojis - Turns off Trend Direction for non-special Dojis.
GS/DF Doji Settings - 2 Inputs that enable and specify how large wicks that typically disqualify Dojis from being 'Gravestone' or 'Dragonfly' Dojis may be.
4 Settings related to 'Long Wick Doji' candles detailed below.
A Tolerance for 'Rickshaw Man' Dojis specifying how close the center of the body must be to the range to be valid.
The 4 settings the user may modify for 'Long Legged' Dojis are: A Sample Base for determining the previous average of wicks, a Sample Length specifying how far back to look for these averages, a Behavior Setting to define how 'Long Legged' Dojis are recognized, and a tolerance to specify how large in comparison to the prior wicks a Doji's wicks must be to be considered 'Long Legged'.
The 'Sample Base' list has two settings:
RANGE: The wicks of prior candles are compared to their candle ranges and the 'wick averages' will be what the average percent of ranges were in the sample.
WICKS: The size of the wicks themselves are averaged and returned for comparing against the current wicks of a Doji.
The 'Behavior' list has three settings:
ONE: Only one wick length needs to exceed the average by the tolerance for a Doji to be considered 'Long Legged'.
BOTH: Both wick lengths need to exceed the average of the tolerance of their respective wicks (upper wicks are compared to upper wicks, lower wicks compared to lower) to be considered 'Long Legged'.
AVG: Both wicks and the averages of the previous wicks are added together, divided by two, and compared. If the 'average' of the current wicks exceeds this combined average of prior wicks by the tolerance, then this would constitute a valid 'Long Legged' Doji. (For Dojis in general - SEE LIMITATIONS)
The final input is one related to candle patterns which require a Marubozu candle in them. The two settings for this input are 'INCLUSIVE' and 'EXCLUSIVE'. If INCLUSIVE is selected, any opening/closing variant of Marubozu candles will be allowed in the patterns that require them.
For two-candle patterns, there are:
2 — Settings which define 'Engulfing' parameters:
Engulfing Setting - Two options, RANGE or BODY which sets up how one candle may 'engulf' the previous.
Inclusive Engulfing - Boolean which enables if 'engulfing' candles can be equal to the values needed to 'engulf' the prior candle.
For the 'Engulfing Setting':
RANGE: If the second candle's high-low range completely covers the high-low range of the prior candle, this is recognized as 'engulfing'.
BODY: If the second candle's open-close completely covers the open-close of the previous candle, this is recognized as 'engulfing'. (SEE LIMITATIONS)
4 — Booleans specifying different settings for a few patterns:
One which allows for 'opens within body' patterns to let the second candle's open/close values match the prior candles' open/close.
One which forces 'Kicking' patterns to have a gap if the Marubozu setting is set to 'INCLUSIVE'.
And Two which dictate if the individual candles in 'Stomach' patterns need to be 'Tall'.
8 — Floating point values which affect 11 different patterns:
One which determines the distance the close of the first candle in a 'Hammer Inverted' pattern must be to the low to be considered valid.
One which affects how close the opens/closes need to be for all 'Lines' patterns (Bull/Bear Meeting/Separating Lines).
One that allows some leeway with the 'Matching Low' pattern (gives a small range the second candle close may be within instead of needing to match the previous close).
Three tolerances for On Neck/In Neck patterns (2 and 1 respectively).
A tolerance for the Thrusting pattern which give a range the close the second candle may be between the midpoint and close of the first to be considered 'valid'.
A tolerance for the two Tweezers patterns that specifies how close the highs and lows of the patterns need to be to each other to be 'valid'.
The first On Neck tolerance specifies how large the lower wick of the first candle may be (as a % of that candle's range) before the pattern is invalidated. The second tolerance specifies how far up the lower wick to the close the second candle's close may be for this pattern. The third tolerance for the In Neck pattern determines how far into the body of the first candle the second may close to be 'valid'.
For the remaining patterns (3, 4, and 5 candles), there are:
3 — Settings for the Deliberation pattern:
A boolean which forces the open of the third candle to gap above the close of the second.
A tolerance which changes the proximity of the third candle's open to the second candle's close in this pattern.
A tolerance that sets the maximum size the third candle may be compared to the average of the first two candles.
One boolean value for the Two Crows patterns (standard and Upside Gapping) that forces the first two candles in the patterns to completely gap if disabled (candle 1's close < candle 2's low).
10 — Floating point values for the remaining patterns:
One tolerance for defining how much the size of each candle in the Identical Black Crows pattern may deviate from the average of themselves to be considered valid.
One tolerance for setting how close the opens/closes of certain three candle patterns may be to each other's opens/closes.*
Three floating point values that affect the Three Stars in the South pattern.
One tolerance for the Side-by-Side patterns - looks at the second and third candle closes.
One tolerance for the Stick Sandwich pattern - looks at the first and third candle closes.
A floating value that sizes the Concealing Baby Swallow pattern's 3rd candle wick.
Two values for the Ladder Bottom pattern which define a range that the third candle's wick size may be.
* This affects the Three Black Crows (non-identical) and Three White Soldiers patterns, each require the opens and closes of every candle to be near each other.
The first tolerance of the Three Stars in the South pattern affects the first candle body's center position, and defines where it must be above to be considered valid. The second tolerance specifies how close the second candle must be to this same position, as well as the deviation the ratio the candle body to its range may be in comparison to the first candle. The third restricts how large the second candle range may be in comparison to the first (prevents this pattern from being recognized if the second candle is similar to the first but larger).
The last two floating point values define upper and lower limits to the wick size of a Ladder Bottom's fourth candle to be considered valid.
█ HOW TO USE
While there are many moving parts to this script, I attempted to set the default values with what I believed may help identify the most patterns within reasonable definitions. When this script is applied to a chart, the Candle Detection Mode (along with the BREAKOUT settings) and all candle switches must be confirmed before patterns are displayed. All switches are on by default, so this gives the user an opportunity to pick which patterns to identify first before playing around in the settings.
All of the settings/inputs described above are meant for experimentation. I encourage the user to tweak these values at will to find which set ups work best for whichever charts they decide to apply these patterns to.
Refer to the patterns themselves during experimentation. The statistic information provided on the tooltips of the patterns are meant to help guide input decisions. The breadth of candlestick theory is deep, and this was an attempt at capturing what I could in its sea of information.
█ LIMITATIONS
DISCLAIMER: While it may seem a bit paradoxical that this script aims to use past performance to potentially measure future results, past performance is not indicative of future results . Markets are highly adaptive and often unpredictable. This script is meant as an informational tool to show how patterns may behave. There is no guarantee that confidence intervals (or any other metric measured with this script) are accurate to the performance of patterns; caution must be exercised with all patterns identified regardless of how much information regarding prior performance is available.
Candlestick Theory - In the name, Candlestick Theory is a theory , and all theories come with their own limits. Some patterns identified by this script may be completely useless/unprofitable/unpredictable regardless of whatever combination of settings are used to identify them. However, if I truly believed this theory had no merit, this script would not exist. It is important to understand that this is a tool meant to be utilized with an array of others to procure positive (or negative, looking at you, short sellers ) results when navigating the complex world of finance.
To address the functionality note however, this script has an offset of 1 by default. Patterns will not be identified on the currently closing candle, only on the candle which has most recently closed. Attempting to have this script do both (offset by one or identify on close) lead to more trouble than it was worth. I personally just want users to be aware that patterns will not be identified immediately when they appear.
Trend Direction - Moving Averages - There is a small quirk with how MA settings will be adjusted if the user inputs two moving averages of the same length when the "MA Setting" is set to 'BOTH'. If Moving Averages have the same length, this script will default to only using MA 1 regardless of if the types of Moving Averages are different . I will experiment in the future to alleviate/reduce this restriction.
Price Analysis - BREAKOUT mode - With how identifying patterns with a look-ahead confirmation works, the percent returns for patterns that break out in either direction will be calculated on the same candle regardless of if P/L Offset is set to 'FROM CONFIRMATION' or 'FROM APPEARANCE'. This same issue is present in the Hikkake Hunter script mentioned earlier. This does not mean the P/L calculations are incorrect , the offset for the calculation is set by the number of candles required to confirm the pattern if 'FROM APPEARANCE' is selected. It just means that these two different P/L calculations will complete at the same time independent of the setting that's been selected.
Adaptive Coloring/Hard Limiting - Hard Limiting is only used with Adaptive Coloring and has no effect outside of it. If Hard Limiting is used, it is recommended to increase the 'Positive' and 'Negative' return tolerance values as a pattern's bullish/bearishness may be disproportionately represented with the gradient generated under a hard limit.
TARGET MODE - This mode will break rules regarding patterns that are overridden on purpose. If a pattern selected in TARGET mode would have otherwise been absorbed by a larger pattern, it will have that pattern's percent return calculated; potentially leading to duplicate returns being included in the matrix of all returns recognized by this script.
'Tall' Candle Setting - This is a wide-reaching setting, as approximately 30 different patterns or so rely on defining 'Tall' candles. Changing how 'Tall' candles are defined whether by the tolerance value those candles need to exceed or by the values of the candle used for the baseline comparison (RANGE/BODY) can wildly affect how this script functions under certain conditions. Refer to the tooltip of these settings for more information on which specific patterns are affected by this.
Doji Settings - There are roughly 10 or so two to three candle patterns which have Dojis as a part of them. If all Dojis are disabled, it will prevent some of these larger patterns from being recognized. This is a dependency issue that I may address in the future.
'Engulfing' Setting - Functionally, the two 'Engulfing' settings are quite different. Because of this, the 'RANGE' setting may cause certain patterns that would otherwise be valid under textbook and online references/definitions to not be recognized as such (like the Upside Gap Two Crows or Three Outside down).
█ PATTERN LIST
This script recognizes 85 patterns upon initial release. I am open to adding additional patterns to it in the future and any comments/suggestions are appreciated. It recognizes:
15 — 1 Candle Patterns
4 Hammer type patterns: Regular Hammer, Takuri Line, Shooting Star, and Hanging Man
9 Doji Candles: Regular Dojis, Northern/Southern Dojis, Gravestone/Dragonfly Dojis, Gapping Up/Down Dojis, and Long-Legged/Rickshaw Man Dojis
White/Black Long Days
32 — 2 Candle Patterns
4 Engulfing type patterns: Bullish/Bearish Engulfing and Last Engulfing Top/Bottom
Dark Cloud Cover
Bullish/Bearish Doji Star patterns
Hammer Inverted
Bullish/Bearish Haramis + Cross variants
Homing Pigeon
Bullish/Bearish Kicking
4 Lines type patterns: Bullish/Bearish Meeting/Separating Lines
Matching Low
On/In Neck patterns
Piercing pattern
Shooting Star (2 Lines)
Above/Below Stomach patterns
Thrusting
Tweezers Top/Bottom patterns
Two Black Gapping
Rising/Falling Window patterns
29 — 3 Candle Patterns
Bullish/Bearish Abandoned Baby patterns
Advance Block
Collapsing Doji Star
Deliberation
Upside/Downside Gap Three Methods patterns
Three Inside/Outside Up/Down patterns (4 total)
Bullish/Bearish Side-by-Side patterns
Morning/Evening Star patterns + Doji variants
Stick Sandwich
Downside/Upside Tasuki Gap patterns
Three Black Crows + Identical variation
Three White Soldiers
Three Stars in the South
Bullish/Bearish Tri-Star patterns
Two Crows + Upside Gap variant
Unique Three River Bottom
3 — 4 Candle Patterns
Concealing Baby Swallow
Bullish/Bearish Three Line Strike patterns
6 — 5 Candle Patterns
Bullish/Bearish Breakaway patterns
Ladder Bottom
Mat Hold
Rising/Falling Three Methods patterns
█ WORKS CITED
Because of the amount of time needed to complete this script, I am unable to provide exact dates for when some of these references were used. I will also not provide every single reference, as citing a reference for each individual pattern and the place it was reviewed would lead to a bibliography larger than this script and its description combined. There were five major resources I used when building this script, one book, two websites (for various different reasons including patterns, moving averages, and various other articles of information), various scripts from TradingView's public library (including TradingView's own source code for *all* candle patterns ), and PineScrypt's reference manual.
Bulkowski, Thomas N. Encyclopedia of Candlestick Patterns . Hoboken, New Jersey: John Wiley & Sons Inc., 2008. E-book (google books).
Various. Numerous webpages. CandleScanner . 2023. online. Accessed 2020 - 2023.
Various. Numerous webpages. Investopedia . 2023. online. Accessed 2020 - 2023.
█ AKNOWLEDGEMENTS
I want to take the time here to thank all of my friends and family, both online and in real life, for the support they've given me over the last few years in this endeavor. My pets who tried their hardest to keep me from completing it. And work for the grit to continue pushing through until this script's completion.
This belongs to me just as much as it does anyone else. Whether you are an institutional trader, gold bug hedging against the dollar, retail ape who got in on a squeeze, or just parents trying to grow their retirement/save for the kids. This belongs to everyone.
Private Beta for new features to be tested can be found here .
Vires In Numeris
Sniffer
╭━━━╮╱╱╱╱╭━╮╭━╮
┃╭━╮┃╱╱╱╱┃╭╯┃╭╯
┃╰━━┳━╮╭┳╯╰┳╯╰┳━━┳━╮
╰━━╮┃╭╮╋╋╮╭┻╮╭┫┃━┫╭╯
┃╰━╯┃┃┃┃┃┃┃╱┃┃┃┃━┫┃
╰━━━┻╯╰┻╯╰╯╱╰╯╰━━┻╯
Overview
A vast majority of modern data analysis & modelling techniques rely upon the idea of hidden patterns, wether it is some type of visualisation tool or some form of a complex machine learning algorithm, the one thing that they have in common is the belief, that patterns tell us what’s hidden behind plain numbers. The same philosophy has been adopted by many traders & investors worldwide, there’s an entire school of thought that operates purely based on chart patterns. This is where Sniffer comes in, it is a tool designed to simplify & quantify the job of pattern recognition on any given price chart, by combining various factors & techniques that generate high-quality results.
This tool analyses bars selected by the user, and highlights bar clusters on the chart that exhibit similar behaviour across multiple dimensions. It can detect a single candle pattern like hammers or dojis, or it can handle multiple candles like morning/evening stars or double tops/bottoms, and many more. In fact, the tool is completely independent of such specific candle formations, instead, it works on the idea of vector similarity and generates a degree of similarity for every single combination of candles. Only the top-n matches are highlighted, users get to choose which patterns they want to analyse and to what degree, by customising the feature-space.
Background
In the world of trading, a common use-case is to scan a price chart for some specific candlestick formations & price structures, and then the chart is further analysed in reference to these events. Traders are often trying to answer questions like, when was the last time price showed similar behaviour, what are the instances similar to what price is doing right now, what happens when price forms a pattern like this, what were some of other indicators doing when this happened last(RSI, CCI, ADX etc), and many other abstract ideas to have a stronger confluence or to confirm a bias.Having such a context can be vital in making better informed decisions, but doing this manually on a chart that has thousands of candles can have many disadvantages. It’s tedious, human errors are rather likely, and even if it’s done with pin-point accuracy, chances are that we’ll miss out on many pieces of information. This is the thought that gave birth to Sniffer .
Sniffer tries to provide a general solution for pattern-based analysis by deploying vector-similarity computation techniques, that cover the full-breadth of a price chart and generate a list of top-n matches based on the criteria selected by the user. Most of these techniques come from the data science space, where vector similarity is often implemented to solve classification & clustering problems. Sniffer uses same principles of vector comparison, and computes a degree of similarity for every single candle formation within the selected range, and as a result generates a similarity matrix that captures how similar or dissimilar a set of candles is to the input set selected by the user.
How It Works
A brief overview of how the tool is implemented:
- Every bar is processed, and a set of features are mapped to it.
- Bars selected by the user are captured, and saved for later use.
- Once the all the bars have been processed, candles are back-tracked and degree of similarity is computed for every single bar(max-limit is 5000 bars).
- Degree of similarity is computed by comparing attributes like price range, candle breadth & volume etc.
- Similarity matrix is sorted and top-n results are highlighted on the chart through boxes of different colors.
A brief overview of the features space for bars:
- Range: Difference between high & low
- Body: Difference between close & open
- Volume: Traded volume for that candle
- Head: Upper wick for green candles & lower wick for red candles
- Tail: Lower wick for green candles & upper wick for red candles
- BTR: Body to Range ratio
- HTR: Head to Range ratio
- TTR: Tail to Range ratio
- HTB: Head to Body ratio
- TTB: Tail to Body ratio
- ROC: Rate of change for HL2 for four different periods
- RSI: Relative Strength Index
- CCI: Commodity Channel Index
- Stochastic: Stochastic Index
- ADX: DMI+, DMI- & ADX
A brief overview of how degree of similarity is calculated:
- Each bar set is compared to the inout bar set within the selected feature space
- Features are represented as vectors, and distance between the vectors is calculated
- Shorter the distance, greater the similarity
- Different distance calculation methods are available to choose from, such as Cosine, Euclidean, Lorentzian, Manhattan, & Pearson
- Each method is likely to generate slightly different results, users are expected to select the method & the feature space that best fits their use-case
How To Use It
- Usage of this tool is relatively straightforward, users can add this indicator to their chart and similar clusters will be highlighted automatically
- Users need to select a time range that will be treated as input, and bars within that range become the input formation for similarity calculations
- Boxes will be draw around the clusters that fit the matching criteria
- Boxes are color-coded, green color boxes represent the top one-third of the top-n matches, yellow boxes represent the middle third, red boxes are for bottom third, and white box represents user-input
- Boxes colors will be adjusted as you adjust input parameters, such as number of matches or look-back period
User Settings
Users can configure the following options:
- Select the time-range to set input bars
- Select the look-back period, number of candles to backtrack for similarity search
- Select the number of top-n matches to show on the chart
- Select the method for similarity calculation
- Adjust the feature space, this enables addition of custom features, such as pattern recognition, technical indicators, rate of change etc
- Toggle verbosity, shows degree of similarity as a percentage value inside the box
Top Features
- Pattern Agnostic: Designed to work with variable number of candles & complex patterns
- Customisable Feature Space: Users get to add custom features to each bar
- Comprehensive Comparison: Generates a degree of similarity for all possible combinations
Final Note
- Similarity matches will be shown only within last 4500 bars.
- In theory, it is possible to compute similarity for any size candle formations, indicator has been tested with formations of 50+ candles, but it is recommended to select smaller range for faster & cleaner results.
- As you move to smaller time frames, selected time range will provide a larger number of candles as input, which can produce undesired results, it is advised to adjust your selection when you change time frames. Seeking suggestions on how to directly receive bars as user input, instead of time range.
- At times, users may see array index out of bound error when setting up this indicator, this generally happens when the input range is not properly configured. So, it should disappear after you select the input range, still trying to figure out where it is coming from, suggestions are welcome.
Credits
- @HeWhoMustNotBeNamed for publishing such a handy PineScript Logger, it certainly made the job a lot easier.
NSDT Fair Value GapThis script is our version of the "Fair Value Gap".
A Fair Value Gap is nothing more than a series of 3 candles with a gap between a candle high/low and a candle high/low two candles prior.
For example:
A Gap Up - the Low of a candle is higher than the High of two candles back.
A Gap Down - the High of a candle is lower than the Low of two candles back.
Typically, on a Gap Up, the trader would wait for the price to re-enter the Gap, and take a Long position.
Typically, on a Gap Down, the trader would wait for the price to re-enter the Gap, and take a Short position.
We found that simply trading through the Gaps (fill the gap) produced a better result. So we reversed the procedure and the colors to show our suggested direction.
We have added inputs so the trader can determine the size of the Gaps to be plotted on the chart. A minimum and maximum can be set.
The number of Gaps to be displayed can be adjusted.
There is a option to remove Gaps that had been filled, to help keep a clean chart.
Fair Value Gap - FVG - HistogramThis indicator uses a histogram to represent "fair value gaps" ("FVG"). FVG is a popular pattern among modern traders.
This document describes the purpose of the script and discusses the conceptual meaning of "fair value," as well as the connotations attached to it.
█🚀 Based on the previous script - improved clarity
This indicator is a modified version of the "Three Bar Gap (Simple Price Action - with 1 line plot)" indicator, which is also available as open source and can be applied to a chart as a complementary tool along with this indicator.
Differences:
The previous version introduced a "Threshold filter" to reduce the number of lines plotted on charts. This filter introduced two additional parameters for users to consider (ATR length and multiplier). These parameters made the indicator more complicated than intended.
To address this issue of having too many lines in the former version, I proposed a spin-off on this version: It's to consider plotting the magnitude of the FVGs on a histogram instead of using lines on a price chart. In my opinion, a histogram is more suitable for decision-making because it lays out data points side-by-side as bins, which makes comparisons much clearer.
Minor FVGs are expected to have smaller bins compared to their neighboring bins, and in extreme cases, the bins will become seemingly invisible due to the auto-adjusted scale of the y-axis. Therefore, there is no need to filter out any data, and all FVGs can be included in this spin-off version.
█🚀 Candlestick patterns - revisited
This script calculates the displacement of highs and lows over three consecutive bars.
A) Down move: When the high of the recent-confirmed bar is lower than the low of the previous-previous candle.
B) Up move: When the low of the recently-confirmed bar is higher than the high of the previous-previous candle.
█🚀 Parameters
Core Functionality
The purpose of this indicator is to generate bins representing the magnitude of FVGs in the form of a histogram to facilitate the visualization of price movements.
The act of "finding FVGs" does not require any inputs, but users can still customize the colors of the bins to indicate the direction of movement.
Auxiliary functionality: “Key level finder” by searching for large FVGs
The following inputs are optional, in fact, the entire feature can be toggled on/off.
In this example, setting the lookback at 20 means the script will generate a signal if the current histogram bin is taller than all previous bins over the past 20 bars.
█🚀 Applications
Tall histogram bins = key levels .
Traders should observe key levels for entry or exit opportunities.
It is important to note that this indicator was designed for standard time-based charts.
On a separate note, FVGs will not appear in Renko charts with fixed-size bricks. This is because the bricks align with their neighboring bricks. When the bricks are fixed, any displacement between highs and lows within less than or equal to three bars will be zero.
The concept of a "gap" is used to illustrate that price follows a jump-diffusion process, and time intervals can be assigned arbitrarily on the x-axis without needing fixed intervals. This idea was briefly discussed in the previous script's write-up.
█🚀 FAQ: Does it repaint?
No. And please continue reading.
Bins are plotted with a one-bar delay. It only takes one bar for the FVG to become confirmed. Lag is beneficial because it clarifies the need for traders to wait for the bar to close and for the signals to become confirmed before entering or exiting a trade. Experienced traders know that prices tend to retrace, so there is no need to chase. An added bar of delay proves to be useful.
█🚀 Opinion: The term “fair value” can be misleading
Those who come from traditional finance may find the term "fair value gap" somewhat insulting. When encountering the phrase, it can feel like a group of aliens from "Planet Technical Analysis" have intrusively landed on your planet and assertively redefined what "fair value" is supposed to mean.
So, what does "fair value" mean in the realm of technical analysis?
In the world of corporate finance, "fair value" is a subjective estimate of what buyers and sellers are hypothetically willing to pay or accept. Buy-side and sell-side analysts use their own methodologies to determine what constitutes "fair value". These approaches may be based on income, asset, or market comparables. Regardless of the approach used, subjectivity is inherent, and results depend on fundamental data provided by the numbers on financial statements. Valuations are unrelated to candlestick patterns .
When dealing with financial statements, finance professionals who are non-market-participants, such as those working in group reporting practices for reporting issuers, or those hired as external auditors, as required by regulators, may also question what constitutes "fair value". The main concerns always revolve around the assumptions used in valuation models; these are inputs that ultimately require management's judgment, and if not critically questioned, valuations as reported in the statements could end up becoming materially bogus. Both IFRS and U.S. GAAP define "fair value" with the same intended meaning in terms of definitions. We will not delve into the details here. The main point is that "fair value" from a financial reporting perspective has nothing to do with candlesticks .
If a price is already quoted in an actively traded market, you can refer to it to obtain what is known as "mark-to-market". This involves simply referring to the bid or ask price on the reporting date, and you're done - there's no need to read candlesticks !
"Fair value" is a neutral term used by finance professionals in all domains. It is not meant to imply that something is actually "fair." Paying the "fair value" for an asset can still result in overpaying or underpaying for what the asset is worth, depending on different model assumptions. The point is, candlesticks are irrelevant to the analysis of what is considered "fair value" in the realm of traditional finance.
That being said, there is no definitive answer as to why people refer to this pattern as a "fair value gap". It's like one of those oddball interview questions asking you to explain why tennis balls are fuzzy. Whatever answer you give, it's important to note that the subject itself is trivial.
Emphasis of matter on why "fair value" can be misleading
The previous paragraphs were not intended to attack ideas from the realm of technical analysis, nor to assert the true meaning, or lack of meaning, of the term "fair value". Words are constantly evolving. If the term "fair value gap" becomes more widely used to describe the displacement of highs and lows over three bars, then let's call it a "fair value gap".
To be clear, I argue that the term "fair value gap" should not be given a positive connotation. Traders should interpret the word "fair" neutrally. Although these signals occur frequently, if you trade every time there is a signal, you will overtrade and incur astronomical transaction costs over the long run, which can lead to losses.
█🚀 Conclusion:
In the end, what matters is how you apply FVG to trading. As mentioned in the "Applications" section above, traders should look for large FVGs - indicated by tall histogram bins - to identify key levels.
Candle Mania [starlord_xrp]This indicator locates and places markers on known bullish and bearish candles. All candles can be turned on/off in the settings. It also has a setting to display RSI/MFI/Stoch RSI indications of oversold and overbought areas in the background showing areas of higher interest. The last feature is a setting that allows you to see where Heiken-Ashi has switched from green to red and vice-versa. Please let me know if there is anything that you would like to see added or any improvements.
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
Pin Candle DetectionPin candles are a variation of hammer candles that are useful in technical analysis . In particular, when combined with volume profile studies, they can be a powerful set up for long entries or other decision making.
For example, when looking at volume profiles, a long entry would be a fair value area (i.e. 40%) below the close of a pin candle. When combined with a support level , the set up is stronger.
While most scripts look for hammer candles, pin candles are somewhat different in that the length of the wick is significant.
This script and its parameters was built for ES futures 15 min chart in mind.
This script is unique in that it allows for the below parameters to be adjusted to suit other instruments and timeframes:
1. Fib level: Candle must close within a certain retracement level). My preference is 0.55. Some traders like 0.5, while others prefer 0.33
2. Wick length: Pin candles differ from pure hammers in that the length of the wick must be significant. My preference is 7 points on ES (as in $ and not ticks)
Add this script to your alerts to no longer miss these set ups.
Strongest Supports And ResistancesDraws the best support and resistance lines. How it works:
1) Tries every possible line through lows, highs, opens, closes
2) Finds the total hit counts given the confidence interval as input to the candlesticks
3) Calculates the strength of every line according to hit count, total volumes on hits, and timestamps
4) Eliminates similar lines, confidence interval is set as input
5) Selects the strongest 20(changable as an input) lines and draws them on the graph.
Makes your work way easier!!!
Feel free to adjust the parameters for your own style!
Cheers!!
Detect BOS in Five Candles with MTF - Alert [MsF]Japanese below / 日本語説明は英文の後にあります。
-------------------------
*This indicator is based on azmathshah's "Last Three Candles each of Two HTF".
It's a very cool indicator. thank you.
You can detect trend reversal with candlesticks.
It's MTF compatible and can display up to 2 sets of 5 candles of any time frame on the right side of the chart.
By displaying the candles of the upper time frame bars, you can check the trend change and measure the entry timing with the lower time frame bars.
There are two types of alerts.
"Liquidity Sweep": This is an alert when the upper beard (high) of ③ is touched with the next foot.
"Candle Close": An alert when the upper whisker (high) of ③ is exceeded by the closing price of the next bar (generally a strong signal)
-------------------------
ローソク足でトレンド転換を検知するインジケーターです。
MTF対応となっておりチャートの右側に任意タイムフレームのローソク5本を最大2セット表示できます。
上位足のローソクを表示することにより、トレンド転換確認しながら、下位足でエントリータイミングを計ることができます。
アラートは2種類あります。
"Liquidity Sweep":③の上ヒゲ(high)を次の足でタッチした場合のアラートです
"Candle Close":③の上ヒゲ(high)を次の足の終値で上回った場合のアラートです(一般的には強力なシグナルとなります)
ChitukiProduced according to Bitcoin and Ethereum 1D, 1W, and 1M candle charts.
When you use it for general stock charts or altcoins, make sure to backtest it thoroughly before using it.
*To facilitate backtesting, this have a vertical line that allows you to easily specify the start time.😍
This indicator is simply based on the Engulfing patterns.
I focused on finding inflection points and wrote them based on 1D chart.
▲▼ Small and fat arrows: Displays simple engulfing patterns.
(Displays only those whose lengths differ by at least 1.2 times from each other)
↑↓ Slim and long arrows: Displays actual trading. (Backtesting reflects this.)
Compare the 7 lowest points to find the bullish Engulfing .
Compare the 14 highest points to find the Bearish Engulfing .
Switch the long and short positions to each other.
Long/short position entry at the market price, mid-price, and closing price of Engulfing Candles.
The charts from 2014 to January 2023 were back-tested and the error ranges were calculated and adjusted in detail.
In conclusion, you can think of it as an Engulfing Pattern Finder tailored to the Bitcoin chart.
This is how I did trading before I made this indicator, and I programmed the trading method as an indicator and I think it's pretty reliable but...
Please don't blindly trust ONLY the indicator(s).
///Properties setting Recommend///
Base currency : USD
Oder size : 18% of equity
Pyramiding : 21 (in plenty / Bcuz one deal is divided into three times.)
Commission : according to the exchange's commission
Recalculate : None
Margin : never less than 50%
Range DetectionThis is a simple indicator to find the sideways market or ranging market.
It is mainly focused on BTCUSD as BTCUSD doesn’t make big moves each and every candle. It makes big breakouts with one candle and then goes sideways for a longer period of time.
So, this indicator identifies those big candles and plots high and lows of those big candles using lines. New range is created only when new candles close above or below previous major candles high or low.
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.
Three Bar Gap (Simple Price Action - with 1 line plot)This script is tailored towards experienced traders who prefer to view raw price charts during live execution. It searches for a three-bar pattern of what is colloquially called "fair value gap", or "imbalance" and uses a single line to plot the results. The goal is to display price in a way that is as simple as possible so that chart readers who don't prefer to add indicators on their screen will still find this indicator as an acceptable option to consider for.
From a code perspective, this script explores a new PineScript feature called UDT (user-defined types). This is an incredible update because it brings developers one step close to having the ability to create abstract data types.
█ What is price action?
Experienced traders will tell you that the chart that they use for live execution is raw, clean, and uses no indicators. They say they execute on price action, so what exactly is price action?
There is no formal definition to it, but one can agree that it implies the process of analyzing price without considering the fundamentals, without needing to know what the news was about, and without needing to know any of the Greeks (except for the desire to “seek alpha” Ha.haa...). This is not to say that price action traders are executing in their own vacuums without the need to know what is happening around the world. Surely fundamentals and financial models can be used beforehand for developing a bias for what is being traded, but it’s price-first at the moment of execution. That said, Factor (A) is Price.
Factor (B) is time-perception, it’s how the trader reads the tape. How the trader perceives price to change with respect to time is valuable information. Interpretation of "time" will be elaborated in the next section that talks about candlestick patterns detected by this script.
Putting this together, price action means the analysis of price movement by only considering (A) price, and (B) time, to predict which direction the market will move. A speculative trader is timing the market with the expectation to make a quick in-and-out profit; she/she is using price action. On the other hand, a long term investor holding a diversified portfolio with a strategy based on modern portfolio theory combined with fundamental analysis (at this point candlesticks are irrelevant) but has one additional criteria of, say, can only go Long on a stock when it has closed Green on Daily; he/she is also considered to be executing on price action.
█ Candlestick patterns
This script calculates the displacement of highs and lows over three consecutive bars.
A) Down move = When High of the recent confirmed bar is lower than the Low of the previous-previous candle
B) Up move = When Low of the recent confirmed bar is higher than the High of the previous-previous candle
(Note that its the confirmed bar that is being talked about, so it does not repaint)
An ATR filter will be applied to reduce the number of lines generated as many times they might just be associated with minor price changes.
Interpretations:
When price moves quickly across three bars, it can be thought that it has gapped. Although the candle in the middle appears to be solid, it’s not from a conceptual perspective. This is because time itself is arbitrary; timeframes don’t necessarily have to be fixed intervals. Take stocks with regular trading hours for example, if price makes a breakaway gap and you bundle the after-hours and pre-market sessions together as one candle, never minding that intervals should be fixed, then you will see the exact three-bar-gap patterns. Similar happens during intraday sessions on lower timeframes, if you zoom-in closer, you’ll see that ticks within the middle candle are sparsely dispersed. This is why it's called a gap.
█ Parameters with fixed inputs & assumptions used:
ATR is used for filtering out minor movements that will likely be deemed as irrelevant by trader for the purpose of live execution. The following inputs are required:
A) ATR lookback period
B) Multiplier
The product of ATR(len=A) and B produces a threshold for minimum distance that price must gap by. Initially, it was proposed to be only based on one ATR, but often an ATR is too wide and using it will filter out too many lines. Because of this observation, a multiplier (Parameter B) has been introduced to allow users to apply fractional ATR as a threshold.
█ Applications:
For trend followers: Follow the direction of the gap. Entering above recent high/low points above/below the first impulse with a stop-limit order is a viable tactic.
For contrarians fading a trend: The mid-point is a good point of reference for predicting potential areas of support/resistance.
New Bearish Downtrend Script - Perfect for Short SellingIts been a while since i last uploaded a script, what i have for you today is a script which works very efficiently for downtrends and spotting reversals. This is a script i use on a weekly basis when looking to short sell.
This script includes :
Updated** Rally Candles for HTF and LTF ( End of Impulsive move signal) - The psychology of the candle when used with market information can be viewed as a end or near to the end of a big impulsive leg - when this candle occurs in BEARISH CONDITIONS, we can assume price is likely to move away short term.
Major and Minor Support Levels HTF (Areas of interest)
The Psychology on these levels is price will do something at these key levels - it takes in the last quarter price action of High Open Low Close to generate the price levels and when price comes into these areas we are likely to see a bounce or rejection from this area.
Bearish Breakout Volume Candle - This candle will paint a Purple colour bar when volume breaks above the 7day average - this shows strong momentum in the market and will usually be seen when price is in a downtrend with strong momentum.. However when this does occur we can expect a short term bounce or base so don't trade the volume bar alone.
Indecision Candles - Psychology of this candle is to show exhaustion in the trend and ideally what to see this candle appear with Rally Candles at key areas for stronger set up. When the trend is moving up, the bearish doji can appear - i tend to look at this situation as a pause in the trend.
200 EMA
Everything in this script has alert conditions to provide an edge in the markets
This is an example of how the script will look on the HTF I'm using the Daily Timeframe for reference on TSLA
This is an example of how the script looks like on the LTF, price hit the Major Resistance twice and failed to hit the 3rd time and on each leg of the impulse, the chart portrayed the LTF Rally Candles
Heres an example on how to use both Major Resistance ( Area of Interest) Rally Candle and Volume Breakout as a trade set up idea - This setup idea was on Crude Oil last week and into this week.
When added to confluences such as Supply Zones, Mitigation Levels, Quasimodo patterns etc... this will enhance the script.
I will answer any questions if i haven't made the script clear or take any requests to improve the script.
Also will be uploading the Bullish Uptrend Script soon.
RSI TREND FILTERRSI TREND Filter on Chart
RSI scaled to fit on chart instead of oscillator, Trend Analysis is easy and Hidden Divergence is revealed using this indicator. This indicator is an aim to reduce confusing RSI Situations. The Oversold and Overbought lines help to determine the price conditions so its easy to avoid Traps.
Oversold and Overbought conditions are marked on Chart to make it useful to confirm a Buy or Sell Signals.
RSI 50 level is plotted with reference to EMA50 and Oversold and Overbought Conditions are calculated accordingly.
Uptrend: RSI Cloud / Candles above RSI 50 Level
Down Trend: RSI Cloud / Candles below RSI 50 Level
Sideways : Candles in the Gray Area above and below RSI 50 Level
Default RSI (14) : is the Candlestick pattern itself
Disclaimer: Use Solely at your own Risk.