ICT Session Opening FVG / Silver Bullet [MK]Students of ICT concepts will know that the first FVG found within particular session periods can identify an important price level for intraday traders.
"Find the first FVG at the start of the session and drag a box from it to the right"....ICT
The script finds the first FVG (either bull or bear) within the following periods:
London Killzone (0200 - 0500) EST
02:00 - 0259
03:00 - 0359
0400 - 0459
Dead Zone (05-00 - 0600) EST
05-00 - 0559
0600 - 0659
NY AM Killzone (0700 - 1100) EST
0700 - 0759
0830 - 0929
0929 - 0959
1000 - 1100 (Silver Bullet)
A chart higher timeframe can be chosen to detect the FVGs and they will be displayed on lower timeframe. Default is 5min for detection. I like to then following price reacting to 5mi FVGs on a 1 min chart.
FVG boxes can be extended to the end of the session, or to any time within the current days trading hours. Colors/Labels/ Session Periods can all be edited. A maximum timeframe for display is available and
timezone can be adjusted.
FVGs are only shown for the current days trading hours.
Multitimeframe
Daily Gaps & Trapped PositionsThis script builds substantially upon the default Gaps script provided by Tradingview. Functionality was added to allow users to decide what price from the previous session is used to determine a daily gap, added support for showing gaps across all timeframes up to the daily time frame, and also allow gaps to be shown even with ETH enabled on the chart. This script provides support across normal securities, futures, and also crypto.
Users can decide between the following selections to determine if a daily gap has formed:
- Previous Session Close
- Previous Session High/Low
- Last RTH Candle High/Low
The other larger piece that was added is something called trapped positions or what some folks familiar with Market Profile would call "single prints". They could also be considered FVGs but they are a specific subset of FVGs as these must from above or below the current session's high/low.
Single prints form above or below a current session's high/low and can be considered an area where price has moved too fast in that area and price will most likely return to these areas at a later point in time. In some teachings, these are also looked at as "trapped shorts" (lighter blue box color) or "trapped supply" (yellow orange box color) which creates an area where there will be potential support (trapped shorts) or resistance (trapped supply) when this area is revisited in the future. Adding these to your chart will simply provide additional areas of interest where you may see buying or selling.
Both gaps and trapped positions have the following options:
- Show only active gaps/trapped positions. Selecting this will only show areas where price has not completely traded through the box.
- Close gaps/trapped positions partially. If this is selected, it will reduce the box size as price is traded through the area. If it is not selected, the box will only disappear once price has traded through the entire box completely.
There are some additional settings that allow you to tailor how many boxes show up on the chart. These settings are as follows:
- Max number of boxes. This setting will only plot up to this number of gaps/trapped positions.
- Minimum Deviation. This will prevent gaps/trapped positions from showing if they are too small relative to average across that last 14 periods.
- Limit Max Box Trail Length (bars). If checkbox is selected, the box will stop being extended after X number of bars given in this input.
Buy / Sell Fractal Algorithm with SL Line GenerationThis algorithm is designed for usage across indices.
How it works?
The algorithm uses a variation of fractals, momentum, RSI and LRSI to determine a trends direction.
The Relative Strength Index (RSI) is a momentum-based oscillator used to measure the speed (velocity) and change (magnitude) of directional price movements. It provides a visual means to monitor both the current and historical strength and weakness of a particular market. The strength or weakness is based on closing prices over the duration of a specified trading period, creating a reliable metric of price and momentum changes
Momentum in trading refers to the direction and magnitude of price. Momentum plays a key role in assessing trend strength, and it is important to know when a trend is slowing down. Less momentum does not always lead to a reversal, but it does signal that something is changing, and the trend may consolidate or reverse
Fractals are patterns within price changes which are repeated across thousands of bars. Examples of fractals include the golden ratio, PHI and the spirals of the milk way. They are quite literally a universal concept.
Basics of usage:
When a bullish trend is detected; the algorithm will generate a green "SL Line" at a calculated point, which can be interpreted as an invalidation line.
If the price goes below this line, the bullish trend is invalidated. So long as it holds, the bullish trend is true until the next detection change.
When a bearish trend is detected; the algorithm will generate a red "SL Line", at a calculated point, which can be interpreted as an invalidation line.
If the prices goes above this line, the bearish trend is invalidated. So long as it holds, the bearish trend is true until the next detection change.
When a given trend is invalidated, the SL Line turns yellow and you enter a "pause zone", where neither a bearish nor bullish trend is calculated.
This resets itself on the next trend detection.
Additional information:
I have coded my own backtest to this algorithm, along with plotting the profit / loss of each generated trade.
The profit is calculated by the difference between the open bar of the trade after a long ( or short ) and the following trade.
If we are calculating a short, the resulting value is then multiplied by -1 to get a positive integer.
For calculating a loss we take the value of the open bar of the trade that generates a long, and take the difference between this and the SL line, and similarly for short positions. The code assumes the user is placing their SL at the indicated line.
Within the input settings there are a few customisation options:
Alpha & Fractal Energy Length & Source - Should not be changed.
Highly bands crossover? - Has no visible effect whether on or off. It refers to the fractal chart which in this iteration is not visible and rather a backend mechanic.
Apply fractal energy? - Should generally be left turned on. This is a noise reduction. Disabling will result in over-trading.
Apply normalization? - Has no impact, is solely used to make the fractal values more human-readable rather than decimal format.
Offset - refers to the offset value of the SL Line generations. This should be set to a value that gives you enough breathing room, and remember to include any spreads! Default is 0.2, written in %
Trading hours - This simply gives a session input for the trading hours you want to trade within, and then colours the background green for that session. Trading 24/7 is never a wise strategy, stick to whatever is most optimal for you.
Leverage - Whatever leverage you are using. Default is x20. This will affect the profit / loss calculations accordingly.
Start equity - refers to the equity value you want to backtest with. Some assets will generate NA for this in the backtest label explained later.
Label customisation options.
Note that the backtest label is by default hidden, and appears when you hover over the black label at the current bar. When enabled to visible, it will show a large text label that may cover your chart screen more than you wish.
Alerts -
There are dozens of alert functionalities here; first are the timeframe assignments for each alert, set by default to 2hrs.
These timeframes then affect the asset you select in the corresponding setting.
In total there are 8 additional assets you can set alerts for.
Once you have assigned the timeframe and asset for an alert, you can then check the tick box for that individual alert.
Once done, you set the alert as normal through the tradingview alerts window. Remember to set "alert function calls only"
-
Timers:
I have added some functionality for timers to be set, values are in minutes. These work on the exact time of placement. Do not change the extra symbol formula option.
-
Note that this backtest is not intended as a replacement for tradingview backtest, nor is there a guarantee that historical results are to be replicated in the future. Trading is inherently risky.
Higher TimeFrame Smooth Moving AveragesScript is designed for those who dislike how plotting a moving average from a higher timeframe on a lower timeframe chart results in a choppy zigzag line when using the standard request.security(syminfo.ticker,"x",ta.sma(src,len)) method.
My more elegant solution was to translate the chart's current timeframe, and the selected higher timeframe into seconds, then check if selected timeframe is Larger than chart timeframe, but not so large that too many bars would be necessary. Then the quotient is calculated by dividing the chosen timeframe (value in seconds) by the chart's timeframe (value in seconds).
Then take that quotient and multiply it by the chosen length. This gives us how many bars of the chart's timeframe would be used in calculating the higher timeframe Moving Average
Use the value to calculate a moving average of choice (SMA,EMA,WMA,LRC,DEMA,TEMA,TRIMA,FRAMA) thanks to @TradingView 's ta library () and @alexgrover 's () for their functions supporting series as length, making this possible.
Basically, get how many of the current chart's bars are in the higher timeframe moving average and use that as the length for calculation using chart's timeframe.
If the higher timeframe relative is too large relative to chart's timeframe, due to bar referencing limits some combinations may not be possible under current limitations, but most will work by either moving chart's timeframe higher or higher timeframe lower assuming you aren't trying to do something too extreme like plotting a weekly moving average onto a 30 second chart etc.
Dual timeframe calculated candlesA script example to show how you can calculate the value of certain indicators from a higher timeframe at the moment that a bar closes on a shorter timeframe.
In this example the base chart is set to 5 mins and the multiplier is set to 6, so the HTF arrays hold data equivalent to that from the 30 minute chart which will hopefully appear below it on this display.
Each time a 5 minute bar completes, the arrays are updated by checking whether a new high or low has been set. The values for the HTF ATR and EMA are also updated by removing the most recent value from that array and replacing it with the value that would have been calculated based on the close at that time. As such for back testing purposes you'd know exactly what the 30 min chart would have been showing you at any one of the 5 minute intervals. Useful for backtesting strategies if you would rather act on the "up to the minute" HTF data, rather than the HTF data from the last HTF close, which could be significantly delayed if you're using a high enough multiplier.
Extended Session High/Low - Intraday and daily chartsThis script plots the extended session highest high and lowest low levels. It works on any time frame from 1 minute to daily.
Please note that during the extended session, TradingView stops updating the daily chart. This means that once the script is loaded on a daily chart, it will not be updated until the market opens, unless you manually reload the layout (Ctrl+R). For this reason, it is recommended to use a multi-timeframe layout, so when the pre/post market line is near the extended session high/low on the daily chart, you can compare these values with those on an intraday chart of the same ticker.
The extended session high/low are important for day traders because they represent the maximum and minimum limits within which the trades have taken place during the extended trading hours. This can make them levels of support/resistance that can be useful for planning trend following, reversal and range-bound strategies.
By displaying the extended session high/low on the daily chart, traders can also see if there are any significant levels nearby that are related to the daily time frame, such as trendlines, support/resistance levels, or moving averages. This can help the trader evaluate whether there is enough room for a price movement in the direction of his trading strategy.
Short Sale Restriction (SSR) Level - Intraday and daily chartsThis script plots the Short Sale Restriction (SSR) Level relative to the previous day's closing price. It works on any time frame from 1 minute to daily, showing the correct level even during the extended session.
The Short Sale Restriction (SSR) is a rule of the Securities and Exchange Commission (SEC) that restricts traders from short-selling stocks that are rapidly decreasing in value in an attempt to profit from the price drop. The rule was introduced in 2010, after the 2008 financial crisis, to prevent market manipulation and excessive volatility.
The SSR works as follows: when the price of a particular stock drops 10% compared to the previous day's closing price, the SSR is triggered and a temporary limitation is imposed on traders' ability to short-sell that stock for the rest of the trading day and the following day. During the SSR activation period, traders can still short-sell, but only if the sale is "covered" by another long position on the same stock.
Knowledge of the SSR level is especially important for day traders because it helps them to plan their trading strategies in advance, avoiding situations where short-selling becomes more difficult. Additionally, if a stock has exceeded the SSR threshold, traders can expect an increase in price volatility.
FX Sessions & Killzones ETJust another sessions indicator. Among all the many existing ones, I didn't find anything simple that would cover my needs and that would actually be correct.
New York time is forced here for plotting the stripes so you don't need to worry about the time zone currently set on your chart. The indicator will be accurate during Daylight Saving Time (which, in 2023 for example, started on Sunday, 12 March , 02:00:00 and will be in effect until Sunday, 5 November, 02:00:00).
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
Inversion GapsAn inverted fair value gap (FVG) occurs when candles start closing below a bullish FVG or above a bearish FVG and in this case, support FVGs become resistances and vice versa. This is a smart money concept introduced by ICT. While we a number of have indicators for FVGs, we don't have any for inversion FVGs. This indicator is just for that - it shows FVGs only after they're inverted.
The meat of it comes from being able to plot HTF inverted FVGs in LTF. In the above BTC chart, you can see M15 inverted FVGs plotted on M1 chart and you can see price respecting them. Mitigations can also be shown as lines (as you can see in the chart).
You can also setup alerts for formation and mitigation of such inversion FVGs.
Regression Channel Alternative MTF V2█ OVERVIEW
This indicator is a predecessor to Regression Channel Alternative MTF , which is coded based on latest update of type, object and method.
█ IMPORTANT NOTES
This indicator is NOT true Multi Timeframe (MTF) but considered as Alternative MTF which calculate 100 bars for Primary MTF, can be refer from provided line helper.
The timeframe scenarios are defined based on Position, Swing and Intraday Trader.
Suppported Timeframe : W, D, 60, 15, 5 and 1.
Channel drawn based on regression calculation.
Angle channel is NOT supported.
█ INSPIRATIONS
These timeframe scenarios are defined based on Harmonic Trading : Volume Three written by Scott M Carney.
By applying channel on each timeframe, MW or ABCD patterns can be easily identified manually.
This can also be applied on other chart patterns.
█ CREDITS
Scott M Carney, Harmonic Trading : Volume Three (Reaction vs. Reversal)
█ TIMEFRAME EXPLAINED
Higher / Distal : The (next) longer or larger comparative timeframe after primary pattern has been identified.
Primary / Clear : Timeframe that possess the clearest pattern structure.
Lower / Proximate : The (next) shorter timeframe after primary pattern has been identified.
Lowest : Check primary timeframe as main reference.
█ FEATURES
Color is determined by trend or timeframe.
Some color is depends on chart contrast color.
Color is determined by trend or timeframe.
█ EXAMPLE OF USAGE / EXPLAINATION
Market Structure & Liquidity: CHoCHs+Nested Pivots+FVGs+Sweeps//Purpose:
This indicator combines several tools to help traders track and interpret price action/market structure; It can be divided into 4 parts;
1. CHoCHs, 2. Nested Pivot highs & lows, 3. Grade sweeps, 4. FVGs.
This gives the trader a toolkit for determining market structure and shifts in market structure to help determine a bull or bear bias, whether it be short-term, med-term or long-term.
This indicator also helps traders in determining liquidity targets: wether they be voids/gaps (FVGS) or old highs/lows+ typical sweep distances.
Finally, the incorporation of HTF CHoCH levels printing on your LTF chart helps keep the bigger picture in mind and tells traders at a glance if they're above of below Custom HTF CHoCH up or CHoCH down (these HTF CHoCHs can be anything from Hourly up to Monthly).
//Nomenclature:
CHoCH = Change of Character
STH/STL = short-term high or low
MTH/MTL = medium-term high or low
LTH/LTL = long-term high or low
FVG = Fair value gap
CE = consequent encroachement (the midline of a FVG)
~~~ The Four components of this indicator ~~~
1. CHoCHs:
•Best demonstrated in the below charts. This was a method taught to me by @Icecold_crypto. Once a 3 bar fractal pivot gets broken, we count backwards the consecutive higher lows or lower highs, then identify the CHoCH as the opposite end of the candle which ended the consecutive backwards count. This CHoCH (UP or DOWN) then becomes a level to watch, if price passes through it in earnest a trader would consider shifting their bias as market structure is deemed to have shifted.
•HTF CHoCHs: Option to print Higher time frame chochs (default on) of user input HTF. This prints only the last UP choch and only the last DOWN choch from the input HTF. Solid line by default so as to distinguish from local/chart-time CHoCHs. Can be any Higher timeframe you like.
•Show on table: toggle on show table(above/below) option to show in table cells (top right): is price above the latest HTF UP choch, or is price below HTF DOWN choch (or is it sat between the two, in a state of 'uncertainty').
•Most recent CHoCHs which have not been met by price will extend 10 bars into the future.
• USER INPUTS: overall setting: SHOW CHOCHS | Set bars lookback number to limit historical Chochs. Set Live CHoCHs number to control the number of active recent chochs unmet by price. Toggle shrink chochs once hit to declutter chart and minimize old chochs to their origin bars. Set Multi-timeframe color override : to make Color choices auto-set to your preference color for each of 1m, 5m, 15m, H, 4H, D, W, M (where up and down are same color, but 'up' icon for up chochs and down icon for down chochs remain printing as normal)
2. Nested Pivot Highs & Lows; aka 'Pivot Highs & Lows (ST/MT/LT)'
•Based on a seperate, longer lookback/lookforward pivot calculation. Identifies Pivot highs and lows with a 'spikeyness' filter (filtering out weak/rounded/unimpressive Pivot highs/lows)
•by 'nested' I mean that the pivot highs are graded based on whether a pivot high sits between two lower pivot highs or vice versa.
--for example: STH = normal pivot. MTH is pivot high with a lower STH on either side. LTH is a pivot high with a lower MTH on either side. Same applies to pivot lows (STL/MTL/LTL)
•This is a useful way to measure the significance of a high or low. Both in terms of how much it might be typically swept by (see later) and what it would imply for HTF bias were we to break through it in earnest (more than just a sweep).
• USER INPUTS: overall setting: show pivot highs & lows | Bars lookback (historical pivots to show) | Pivots: lookback/lookforward length (determines the scale of your pivot highs/lows) | toggle on/off Apply 'Spikeyness' filter (filters out smooth/unimpressive pivot highs/lows). Set Spikeyness index (determines the strength of this filter if turned on) | Individually toggle on each of STH, MTH, LTH, STL, MTL, LTL along with their label text type , and size . Toggle on/off line for each of these Pivot highs/lows. | Set label spacer (atr multiples above / below) | set line style and line width
3. Grade Sweeps:
•These are directly related to the nested pivots described above. Most assets will have a typical sweep distance. I've added some of my expected sweeps for various assets in the indicator tooltips.
--i.e. Eur/Usd 10-20-30 pips is a typical 'grade' sweep. S&P HKEX:5 - HKEX:10 is a typical grade sweep.
•Each of the ST/MT/LT pivot highs and lows have optional user defined grade sweep boxes which paint above until filled (or user option for historical filled boxes to remain).
•Numbers entered into sweep input boxes are auto converted into appropriate units (i.e. pips for FX, $ or 'handles' for indices, $ for Crypto. Very low $ units can be input for low unit value crypto altcoins.
• USER INPUTS: overall setting: Show sweep boxes | individually select colors of each of STH, MTH, LTH, STL, MTL, LTL sweep boxes. | Set Grade sweep ($/pips) number for each of ST, MT, LT. This auto converts between pips and $ (i.e. FX vs Indices/Crypto). Can be a float as small or large as you like ($0.000001 to HKEX:1000 ). | Set box text position (horizontal & vertical) and size , and color . | Set Box width (bars) (for non extended/ non-auto-terminating at price boxes). | toggle on/off Extend boxes/lines right . | Toggle on/off Shrink Grade sweeps on fill (they will disappear in realtime when filled/passed through)
4. FVGs:
•Fair Value gaps. Represent 'naked' candle bodies where the wicks to either side do not meet, forming a 'gap' of sorts which has a tendency to fill, or at least to fill to midline (CE).
•These are ICT concepts. 'UP' FVGS are known as BISIs (Buyside imbalance, sellside inefficiency); 'DOWN' FVGs are known as SIBIs (Sellside imbalance, buyside inefficiency).
• USER INPUTS: overall setting: show FVGs | Bars lookback (history). | Choose to display: 'UP' FVGs (BISI) and/or 'DOWN FVGs (SIBI) . Choose to display the midline: CE , the color and the line style . Choose threshold: use CE (as opposed to Full Fill) |toggle on/off Shrink FVG on fill (CE hit or Full fill) (declutter chart/see backtesting history)
////••Alerts (general notes & cautionary notes)::
•Alerts are optional for most of the levels printed by this indicator. Set them via the three dots on indicator status line.
•Due to dynamic repainting of levels, alerts should be used with caution. Best use these alerts either for Higher time frame levels, or when closely monitoring price.
--E.g. You may set an alert for down-fill of the latest FVG below; but price will keep marching up; form a newer/higher FVG, and the alert will trigger on THAT FVG being down-filled (not the original)
•Available Alerts:
-FVG(BISI) cross above threshold(CE or full-fill; user choice). Same with FVG(SIBI).
-HTF last CHoCH down, cross below | HTF last CHoCH up, cross above.
-last CHoCH down, cross below | last CHoCH up, cross above.
-LTH cross above, MTH cross above, STH cross above | LTL cross below, MTL cross below, STL cross below.
////••Formatting (general)::
•all table text color is set from the 'Pivot highs & Lows (ST, MT, LT)' section (for those of you who prefer black backgrounds).
•User choice of Line-style, line color, line width. Same with Boxes. Icon choice for chochs. Char or label text choices for ST/MT/LT pivot highs & lows.
////••User Inputs (general):
•Each of the 4 components of this indicator can be easily toggled on/off independently.
•Quite a lot of options and toggle boxes, as described in full above. Please take your time and read through all the tooltips (hover over '!' icon) to get an idea of formatting options.
•Several Lookback periods defined in bars to control how much history is shown for each of the 4 components of this indicator.
•'Shrink on fill' settings on FVGs and CHoCHs: Basically a way to declutter chart; toggle on/off depending on if you're backtesting or reading live price action.
•Table Display: applies to ST/MT/LT pivot highs and to HTF CHoCHs; Toggle table on or off (in part or in full)
////••Credits:
•Credit to ICT (Inner Circle Trader) for some of the concepts used in this indicator (FVGS & CEs; Grade sweeps).
•Credit to @Icecold_crypto for the specific and novel concept of identifying CHoCHs in a simple, objective and effective manner (as demonstrated in the 1st chart below).
CHoCH demo page 1: shifting tweak; arrow diagrams to demonstrate how CHoCHs are defined:
CHoCH demo page 2: Simplified view; short lookback history; few CHoCHs, demo of 'latest' choch being extended into the future by 10 bars:
USAGE: Bitcoin Hourly using HTF daily CHoCHs:
USAGE-2: Cotton Futures (CT1!) 2hr. Painting a rather bullish picture. Above HTF UP CHoCH, Local CHoCHs show bullish order flow, Nice targets above (MTH/LTH + grade sweeps):
Full Demo; 5min chart; CHoCHs, Short term pivot highs/lows, grade sweeps, FVGs:
Full Demo, Eur/Usd 15m: STH, MTH, LTH grade sweeps, CHoCHs, Usage for finding bias (part A):
Full Demo, Eur/Usd 15m: STH, MTH, LTH grade sweeps, CHoCHs, Usage for finding bias, 3hrs later (part B):
Realtime Vs Backtesting(A): btc/usd 15m; FVGs and CHoCHs: shrink on fill, once filled they repaint discreetly on their origin bar only. Realtime (Shrink on fill, declutter chart):
Realtime Vs Backtesting(B): btc/usd 15m; FVGs and CHoCHs: DON'T shrink on fill; they extend to the point where price crosses them, and fix/paint there. Backtesting (seeing historical behaviour):
KST con HMA---------- ENGLISH DESCRIPTION ----------
The indicator created is called "KST with HMA" and is used to measure the impulse of an asset's price.
The code begins by defining four variables representing ROC (Rate of Change) period lengths for calculating the KST (Know Sure Thing) and a variable for the length of the HMA (Hull Moving Average).
Next, an HMA function is defined to calculate the Hull Moving Average, a type of weighted moving average that adjusts for price volatility.
ROC values are then calculated for the four periods defined above and KST values are calculated as a weighted sum of the ROC values. These values are then normalized with the HMA and the standard deviation of the HMA is calculated. The normalized value is finally plotted with three different color lines: black for values greater than 1, red for values less than -1, and green for values between -1 and 1.
Finally, a black dashed line is plotted to represent the zero line. The green line indicates a phase of market uncertainty or lateralization, while the indicator can be used to identify buy points above zero and sell points below zero.
---------- ITALIAN DESCRIPTION ----------
L'indicatore creato è chiamato "KST con HMA" e viene utilizzato per misurare l'impulso del prezzo di un asset.
Il codice inizia definendo quattro variabili che rappresentano le lunghezze dei periodi di ROC (Rate of Change) per il calcolo del KST (Know Sure Thing) e una variabile per la lunghezza dell'HMA (Hull Moving Average).
Successivamente viene definita una funzione HMA per il calcolo della Hull Moving Average, un tipo di media mobile ponderata che si adatta alla volatilità del prezzo.
Vengono poi calcolati i valori ROC per i quattro periodi definiti in precedenza e calcolati i valori KST come somma ponderata dei valori ROC. Questi valori vengono poi normalizzati con l'HMA e viene calcolata la deviazione standard dell'HMA. Il valore normalizzato viene infine plottato con tre diverse linee di colore: nero per valori superiori a 1, rosso per valori inferiori a -1 e verde per valori tra -1 e 1.
Infine, viene plottata una linea tratteggiata nera per rappresentare la linea zero. La linea verde indica una fase di incertezza o lateralizzazione del mercato, mentre l'indicatore può essere utilizzato per individuare punti di acquisto sopra lo zero e di vendita al di sotto dello zero.
RD Key Levels (Weekly, Daily, Previous vWAP)The RexDog Key Levels indicator plots the weekly open, daily open, and the previous day vWAP close.
These are all critical price levels (zones) to know when trading any market or instrument. These areas are also high probability reaction areas that you can trade using simple confirmation trading patterns.
First, I'll cover an overview of the indicator then I'll share general usage tips.
Weekly Open - default is white/orange. White is when price is above the weekly open. Orange is when price is below the weekly open.
Weekly High/Low - there are options to turn on the weekly high and lows. Default plot is circles. Green is the high. Red is the low.
Daily Open - default is green/red. Green is when price is above the daily open. Red is when price is below the daily open.
Previous vWAPs - aqua single lines. These are the closing price of the daily vWAPs.
Top Indicators - The triangles at the top of the chart signify is price is currently above or below the weekly open. This is helpful on lower timeframe charts (5m, 15m) to get a quick indication when price is far extended beyond the weekly open. Green triangle = above weekly open. Red triangle = below weekly open.
General Usage
Each one of these levels are important levels markets look use for continuation or failure of momentum and bias. I also find it extremely helpful to think of these levels as magnets, dual magnets. They both attract and repel price at the same time. Now you might say, how is that helpful to have opposing views at the same time? Be indifferent to direction, create your own rules on when these price zones repel or attract price, I have my own.
Here's the easiest way to use these price levels.
As price approaches one of these levels to expect a reaction. A reaction is price is going in one direction and price hits a price level zone and reacts in the opposite direction.
These are price zones, sometimes you will see a reaction right at the price but visualize these areas as zones of reaction.
A high percentage of the time when price approaches these level zones there will be a reaction. So trade the reaction .
How do you do that?
Simple. Trade patterns that repeat. I have 3 solid patterns I trade around these key levels:
The first pattern is early entry with precise scale in rules and a very effective protective stop loss placement.
The second pattern is wait for confirmation that the level holds. This requires more patience and for you to fully trust the chart. The benefit of this pattern is with confirmation you have even more precise stop placement.
There is a bonus third pattern I trade around these levels. I call this the confirmation and bluff entry. It's a combination of both of the patterns above. You wait for confirmation but on any pull back you call the bluff on the market and enter on key test. Trade management here is critical. In addition to the pattern you trade you should have a series of failure patterns that tell you to get out of the trade, I use 2 primary failure patterns.
I trade all markets, same system, same rules, so I'll show a few examples.
Usually I start with Bitcoin but let's start with equities:
BA - Boeing - 8 Trades
Here we see weekly low patterns, previous week low test, vwAP hold patterns, day magnets and day holding. Then 2 week failures and a double hold pattern.
These are all straightforward trades to execute following really simple patterns.
BTCUSD Previous vWAP and Day Open Trades
We see here on the circle areas both daily open and previous day vWAP zone tests. Within this chart are all 3 highly effective patterns I trade.
SPY - 7 High Probability Trades
Here we see a pDay vWAP mixed with a daily failure. Next a daily retest, then a pDay vWAP failure, then a vWAP capture and test. Then a double weekly failure test (great trade there) and finally a daily test.
I could provide more examples but most are just derivatives of the above examples.
SMC sessionzz by JelleThe main function of this indicator is to make it easy to identify several smart money concepts (SMC) and ICT practices by using a single indicator. The functions themselves are not my original content, but rather a collection of several scripts with some tweaking, combined into a single indicator.
Main functions:
- Provides the ability to set bar color for London, New York and Asia sessions
- Provides the ability to set background color for London, New York and Asia sessions
- Provides the ability to indicate NY and GMT midnight on the chart by plotting vertical lines
- Provides several smart features to turn bar color and background color on/off depending on the timeframe
Usage example:
- Easily determine each session high and low by using the bar color feature
- Easily determine the daily high and low by using the vertical midnight lines
- Easily determine ICT kill zones by setting background color for each session
- Easily avoid clutter on your chart by using the timeframe filters
Quad RSRelative Strength (RS) is an Indicator which measures a Stock's performance as compared to a Benchmark Index or another Stock.
For example: RS will tell you whether “A” is increasing more or less than “B” in any market condition. It is one of the tools which is best suited for Momentum Investing.
How RS can be used as a Momentum Indicator:
RS is used in identifying both the strongest and the weakest stock, or any asset class, within the market. Usually, the stocks which display strong or weak RS over a given time period tend to continue to move in the same direction.
How to calculate Relative Strength:
Divide change of "A" over some time period by the change of a particular index/stock "B" over the same time period.
This indicator oscillates around zero. If the value is greater than zero, "A" has been relatively strong compared to "B", during the selected period; if the value is less than zero, "A" has been relatively weak.
Configuration & Default settings:
The Relative symbol can be Input, default is Nifty50.
Time frame can be set, I recommend setting to Day. Default time frame is set to same as chart.
Four different periods can be set. Default values are 500, 250, 125 & 63. If time frame is set as 'Day', these numbers correspond to 2 years, 1 year, 1/2 year & 1 quarter.
Example chart: NiftyMidCap100 with Quad RS indicator with Nifty50 used as Relative Symbol, Four periods: 500, 250, 125 & 63
JZ_Chaikin HTF Volatility BreakoutFirst off, all credit to Harry Potter as this is a minor customization of his indicator.
Basic additions:
-- Added a Higher Timeframe that is set to Daily but can be changed. Timeframe does wait until barstate.isconfirmed so won't repaint.
-- Added HMA smoothing line to both Chart and HTF. Can be used as it's own signal, as confirmation or in combination with faster signal line -- Breakout signal & Range Highlight use both.
-- Added optional coloring of HMA based on whether increasing or decreasing.
-- Added a low volatility option that highlights Range/No Trade zones. Defval is off so needs to be selected from inputs.
Breakout Signals are very simple and both take the HTF signal and HMA. When the faster Volatility line rises from below zero and comes within the range of -10 to 0, AND the HMA signals is increasing (and also below zero) for confirmation, generates a breakout signal of an incoming big move. You can alter the breakout threshold to be greater or less than -10, I just found that works best for filtering out the noise and false signals. Won't catch everything, but pretty reliable when it does.
Tested mostly on BTC so can't vouch for other assets and would likely need modification.
I've JUST taught myself coding from scratch (and to say I'm an amateur is an understatement), so apologies in advance if anything is unclear or could be coded better. Open to any suggestions.
MTF Diagonally Layered RSI - 1 minute Bitcoin Bot [wbburgin]This is a NON-REPAINTING multi-timeframe RSI strategy (long-only) that enters a trade only when two higher timeframes are oversold. I wrote it on BTC/USD for 1min, but the logic should work on other assets as well. It is diagonally layered to be profitable for when the asset is in a downtrend.
Diagonal layering refers to entry and exit conditions spread across different timeframes. Normally, indicators can become unprofitable because in downtrends, the overbought zones of the current timeframe are not reached. Rather, the overbought zones of the faster timeframes are reached first, and then a selloff occurs. Diagonally-layered strategies mitigate this by selling diagonally, that is, selling once the faster timeframe reaches overbought and buying once the slower timeframe reaches oversold.
Thus this strategy is diagonally layered down . I may create a separate script that alternates between diagonal-up and diagonal-down based off of overall trend, as in extended trend periods up this indicator may not flash as frequently. This can be visualized in a time series x timeframe chart as an "X" shape. Something to consider...
Let me know if you like this strategy. Feel free to alter the pyramiding entries, initial capital, and entry size, as well as commission regime. My strategies are designed to maximize average profit instead of flashing super frequently, as the fees will eat you up. Additionally, at the time of publication, all of my strategy scripts are intended to have profitable Sharpe and Sortino ratios.
Timeframes, RSI period, and oversold/overbought bounds are configurable.
Multi-Timeframe Trend IndicatorThe Multi-Timeframe Trend Indicator (MTFTI) is a trend analysis tool designed to help traders quickly and easily assess the market direction across multiple timeframes. With the help of a table to visualize the trends on different timeframes.
Key features:
Multi-timeframe trend indicator for the following timeframes: 5 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 6 hours, 12 hours, 1 day, and 1 week and average.
Displays trends for selected timeframes in a table.
Considers short and long-term exponential moving averages (EMAs) to determine trends.
Calculation of the average trend for all timeframes.
Display of trends with appropriate coloring for better readability (green for "Up", red for "Down", and intermediate shades for neutral or strong trends).
List of Parameters
Customization of the table's position on the screen (top-left, top-right, middle-left, middle-right, bottom-left, bottom-right).
Setting the lengths of the short and long-term exponential moving averages.
Option to activate or deactivate the display of EMAs for better customization (true by default).
Please note that the MTFTI is not a guarantee of future market performance and should be used in conjunction with proper risk management. Always ensure that you have a thorough understanding of the indicator’s methodology and its limitations before making any investment decisions. Additionally, past performance is not indicative of future results.
NSDT EMA+ATRI had this idea to make a custom Moving Average that adapts to the market. I chose to use the Average True Range. As the market makes bigger/smaller moves, this custom Moving Average applies the ATR as the length of the EMA. This gives more distance to the Moving Average as the volatility picks up or reduces.
Just set the length you want the ATR to look back (default is 100) and the multiplier (default is 2) to work with the instrument being traded.
It's also setup for use on Multi Time Frames.
RSI Screener and Divergence [5ema]
Displayed on the RSI chart according to a custom timeframe.
Displays the RSI tracking table of various timeframes.
Identify normal divergence, hidden divergence on RSI chat.
Show buy and sell signals (strong, weak) on the board.
Send notifications when RSI has a buy or sell signal.
-----
I reused some functions, made by (i believe that):
©paaax : The table position function.
@everget : The RSI divergence function.
@QuantNomad : The function calculated value and array to show on table for input symbols.
I have commented in my code. Thanks so much!
-----
How it works:
1. Input :
input.int length of RSI => calculate RSI.
input.int upper/lower => checking RSI overbought/oversold.
input.int right bars / left bars => returns price of the pivot low & high point => checking divergence.
input.int range upper / lower bars => compare the low & high point => checking divergence.
input.timeframe => request.security another time frame.
input.string table position => display screener table.
2. Input bool:
plot RSI on chart.
Plot Regular Bullish divergence .
Regular Bearish divergence.
Hidden Bullish divergence .
Hidden Bearish divergence.
3. Basic calculated:
Make function for RSI , pivot low & high point of RSI and price.
Request.security that function for earch time frame.
Result RSI, Divergence.
4. Condition of signal:
Buy condition:
RSI oversold (1)
Bullish divergence (2).
=> Buy if (1) and (2), review buy (1) or (2).
Sell condition:
RSI overbought (3).
Bearish divergence (4).
=> Sell if (3) and (4), review sell (3) or (4).
5. Table screener:
Time frame.
RSI (green - oversold, red - overbought)
Divergence (⬈⬈ - regular bullish , ⬊⬊ regular bearish , ⬊ - hidden bullish , ⬈ - hidden bearish ).
Signal (🟢 - Buy, 🔴 - sell, green 〇 - review buy, red 〇 - review sell)
----
This indicator is for reference only, you need your own method and strategy.
If you have any questions, please let me know in the comments.
SynthSAR ConfirmationThis indicator represents confirmation of a trend based on the PSAR indicator and includes signals from the MACD, stochastic oscillator, and awesome oscillator. It displays the points of the parabolic SAR on the chart, which help determine the direction of the trend. Additionally, the indicator allows for tracking signals based on the combined analysis of three other technical indicators: MACD, stochastic oscillator, and awesome oscillator. Furthermore, the indicator includes the ability to display buy/sell labels and signals for changing the trend direction. This is not an investment recommendation.Very effective in higher timeframes.If the MACD "macd line" crosses the "signal line" from above and the Stochastic %K line crosses the %D line from above, and the last column in the Avesome Oscillator is red, then the indicator gives a signal to sell. If the MACD "macd line" crosses the "signal line" from below and the Stochastic %K line crosses the %D line from below, and the last column in the Avesome Oscillator is green, then the indicator gives a signal to buy.
Pre-market Highs & Lows on regular trading hours (RTH) chartShows pre-market highs and lows on RTH or ETH chart
-Pre-market duration user input (default is 16 'bar hours'; covering the time from S&P RTH close at 4pm >> 9:30am RTH open next day
-Displays on both RTH and ETH charts
-Written for ES (ES1! or e.g ESM2023), but tested and working on SPY, SPX
-Works across timeframes
Example usage on Electronic trading hours (ETH) chart; showing the 'bar hours' user input lookback duration visually