Auto Chart Patterns - Ultimate [Trendoscope]Here is an attempt to gather and present stats and probabilities of different chart patterns. Here, we challenge few traditional biases such as rising wedge is bearish, falling wedge is bullish etc. All the chart patterns identified in this script are bi-directional. Meaning they offer opportunities to trade in either direction.
This indicator is built on the base of two free scripts
🎯 Wedge-and-Flag-Finder-Multi-zigzag
🎯 Trendline-Pairs-Deep-Search
🎲 Following are the major highlights/updates in the present script
▶ Uses the similar deep search algorithm for finding patterns. Pattern identification logic has been optimised to provide more accurate patterns.
▶ Provides suggestion on how to trade these patterns - along with entry, stop and target suggestions.
▶ Advanced options available in setting such as 'Safe Repaint' - which enables repaint only when trade has not started.
▶ Option to run algorithm within specified time window
▶ Comprehensive stats on historical patterns which include win ratio, risk reward, trailing win ratio and trailing risk reward.
▶ Open Trades Stats widget which can help tracking trades easily.
▶ Fully customisable alerts - which can be used to plugin into bots.
🎲 Chart Patterns Included
▶ Channel - Uptrend, Downtrend, Ranging
▶ Triangle - Expanding, Contracting
▶ Rising Wedge - Expanding, Contracting
▶ Falling Wedge - Expanding, Contracting
If unable to determine the type and yet pivots are inline to form two trend lines, then it goes to category - Indeterminate
🎲 Indicator Components
Below is a quick snapshot of indicator components.
Now, lets look at some of the individual components:
▶Open trade stats helps recognise trades in motion.
▶ Closed trade stats can either be shown with minimal stats or fully detailed stats.
🎲 Settings
▶ Generic Settings
▶ Zigzag and pattern selection
▶ Channel Settings
▶ Risk/Reward and Stats/Display Settings
🎲 Key Features
⬤ Safe Repaint :
This option allows redrawing pattern only if trade has not been taken. This increases accuracy of pattern detection. Example of impact of safe repaint is shows as below:
⬤ Trade Reversal or Breakout of Channels :
This option is useful to handle channels of different size. If the distance between channel trendlines are huge, then it is more advantageous to trade reversals. If the distance between trendlines of channel is small, it is more rewarding to trade the breakouts.
Here is an example of how this setting impacts the trade suggestions.
⬤ Detailed Closed Trade Stats :
Closed Stats settings give users option to see in depth details such as risk reward and win ratios for past patterns along with numbers.
⬤ Fully Customisable Alerts :
Alerts are implemented using alert method. Hence, users will not see text box in alert window where they can set alert format. To overcome this challenge, the indicator offers customisation of alerts through settings.
In the settings window, you notice below options for alerts
These settings allow users to enable/disable alerts for different status of patterns. The text box in the settings allows users to set customisable alert formats using specific placeholders.
Valid placeholders are:
{type} - Alert Type
{id} - Pattern id for which alert is generated
{ticker} - Ticker for which alert is generated
{timeframe} - Chart timeframe
{price} - Current close price
{pattern} - Name of the pattern
{longTrade} - Array containing stop, entry, target1 and target2 for long side of the trade for given pattern
{shortTrade} - Array containing stop, entry, target1 and target2 for short side of the trade for given pattern
{status} - Contains status of both long and short side of the trades as text
Default alert template set for all type of alerts is as below
{
"alert" : "{type}",
"id" : {id},
"ticker" : "{ticker}",
"timeframe" : "{timeframe}",
"price" : {price},
"pattern" : "{pattern}",
"long " : {longTrade},
"short " : {shortTrade},
"status" : "{status}"
}
An example alert looks like this:
If you just want to display pattern name and alert type, your alert message in the box should be something like this:
Type - {type}, Pattern - {pattern}
Will make a video on settings and usage when I get time :)
Trendoscope
Zigzag MatrixNothing fancy. Just converted the new matrix library of zigzags ( mZigzag ) into indicator as I sensed it can be useful as indicator.
On top of the standard zigzag, the indicator also tracks given oscillators, moving average and volume indicators on each pivots. More indicators can be added programmatically - but it will take up space in chart. Hence, so far I have only added option to add one per each type (moving average, oscillator and volume)
Settings are as below
Trendline Pairs (Deep Search)After getting good response on Wedge-and-Flag-Finder-Multi-zigzag , I thought I will build little bit further into the script.
Main differences
Uses deep search algorithm for patterns instead of just using last 5 pivots
Flag pattern is removed so that we can concentrate mainly on trend line pairs
More number of overall patterns.
Trend Patterns Included
Channel - Rising, Falling, Ranging
Wedge - Rising, Falling + Expanding, Contracting types
Triangle - Expanding, Contracting
Indeterminate - Happens in rare cases where angle calculation results in error. It may still belong to one of the above patterns.
Please note:
This is published as free to use but protected source code indicator. This is because the script contains deep search algorithm which isn't made public yet and is also been used in other invite only scripts.
Will not be adding alerts to this indicator.
Wedge and Flag Finder (Multi - zigzag)Here is a small attempt to automatically identify wedges and flags.
Tradingview standard wedge checks for only 4 pivots. In this version, I have considered 5 pivots instead - which can help reduce noise as 4 pivots forming wedge can be quite common. In future, will also try to add more pivots in pattern recognition to make the signal more accurate.
If wedge comes with a tail, then it is marked as flag :)
Settings are quite simple and they are as shown below
Intrabar OBV/PVTI got this idea from @fikira's script Intrabar-Price-Volume-Change-experimental
The indicator calculates OBV and PVT based on ticks. Since, the indicator relies on live ticks, it only starts execution after it is put on the charts. The script can be useful in analysing intraday buy and sell pressure. Details are color coded based on the values.
Data is presented in simple tabular format.
Formula for OBV and PVT can be found here:
www.investopedia.com
www.investopedia.com
Max drawdown daysA friendly reminder to myself and rest of the traders that market can stay low for prolonged time!!
Details are pretty simple.
Here is small comparison of the stats for major US indices.
Can also be applied to stocks. Cells are highlighted in red background ii
Drawdown/Recovery is still in progress for historical stats
Current drawdown bars/recovery bars are higher than that of median of All time stats.
Historical Range (Using eStrategy library)⬜ The script is intended to cover few things.
▶ Strategy testing framework based on eStrategy library
▶ Using historicalrange of values for identifying better entry and exits.
This is also built on top of the Systematic Investment Plan script published here
⬜ Strategy testing framework
Strategy testing framework is different from tradingview default strategy testing from few ways to suit the needs of systematic investments.
▶ Supports recurring investment on top of initial investment to emulate adding further funds to the investment bucket on regular basis.
▶ Better calculation of drawdowns based on daily equity rather than drawdown calculated only on close of trade.
▶ Provides better control over how much strategy can reduce and reload
Having said that, this framework is not intended as replacement for tradingview strategy framework. It is not as comprehensive as tradingview strategy framework. But, created to address few specific styles of strategy.
▶ No detailed trade stats on individual trades. But, this can be implemented in future versions
▶ At present only facilitates long positions.
▶ UI features such as plotting trades on chart are not available.
▶ Does not take into consideration of slippage and brokerage - this is not an issue because the framework is not meant for short term trades. It is only made for daily timeframes.
▶ No pyramiding or leverage possible.
And many more...
Framework can be used for similar strategies based on market timing with few small changes.
⬜ Historical Range Strategy
Concept here is, instead of taking indicators such as oscillators as is, use historical percentile to derive better oversold and overbought conditions. Strategy provides different options to base historical range. This can either be based on
▶ Band percent
▶ Oscillator
Different choices of bands and oscillators are also available to chose. However, have not done extensive testing on all the combinations.
⬜ Settings
▶ Initial and recurring investment settings (As confirm inputs)
▶ Buy and hold and strategy specific settings to be used for stat calculation
▶ Band and oscillator parameters
These are straightforward parameters which is used for defining the base of either bands or oscillators.
▶ Percentile moving average parameter
Percentile MA is used with Percentile to find entry and exit signals based on crossover and crossunder.
Feedbacks and suggestions welcome.
Systematic Investment PlanTradingview default strategy tester has few limitations. To name some:
Tradingview default strategy tester does not have option for periodic investment.
Does not allow reduce and refill kind of operations.
Comparison to buy and hold equity does not take into consideration on number of days invested
Hence, I created this as base for my further experiments with respect to strategies involving market timing.
Settings are quite simple and self explanatory.
Auto Harmonic Projection - Ultimate [Trendoscope]Hello traders, Many who used Auto Harmonic Pattern - Ultimate had enquired with me about having option to project PRZ before patterns formed. We always replied that it is in pipeline but will not be part of existing script. Finally, we decided to utilise part of our Christmas and new year break to make it happen.
Lets get started..
⬜ Process
▶ Unlike Auto Harmonic Patterns Ultimate, instead of scanning whole XABCD for harmonic pattern, this script only collects XABC and projects PRZs (Possible D zones)
▶ Once possible patterns are found, lines are drawn to connect XABC and boxes to project PRZs. There can be more than 1 PRZs for XABC combination. If PRZs of multiple patterns overlap, they are joined and shown as single PRZ where all patterns are listed against it.
▶ If price crosses C, pattern is considered as failed. If price stays between C and PRZs for long time, patterns are timed out. In either case, patterns and projections are removed from chart.
▶ Pattern is considered to be active once price reach B. Until then Pattern is inactive.
▶ PRZs are tracked individually even if they belong to same pattern. PRZ is considered active only if price hits PRZ and completes the pattern. Till then PRZ is considered inactive.
▶ After activating, PRZs can either reach successful level if price moves in reversal direction. Or it can reach failure if price reaches stop.
▶ PRZs are removed from chart once it either reaches stop or success level. But, if more PRZs are present for pattern, pattern will still be there on chart.
▶ Pattern is kept active till all the PRZs are either hit stop or success or pattern itself is either failed or timed out.
Note:
Whenever we refer pattern - consider it as lines joining X, A, B, C and D if PRZ is active.
Wherever we refer PRZ - consider it as box representing potential reversal zones.
⬜ Screen components
▶ Inactive Patterns and PRZ - Patterns with inactive PRZs are represented as lines joining XABC. There will not be line connecting D and PRZs are shown with faded colour and smaller fonts.
▶ Active Patterns and PRZ - Patterns with active PRZ are represented with full pattern and line fills. PRZ will also show stop and success level. Note that success level is not target level - but a position used for validating the outcome.
▶ Stats table - Open stats table contains patterns and corresponding PRZ levels. Stats will have red background for bearish patterns/projections and green background for bullish patterns/projections. Content text colour is matched with that of PRZ and Pattern line colors so that users can identify the matching stats easily.
▶ Run timer - Tells how long the script backtest is running. Run timer will have red background for TRIAL access or if right access key is not used. Otherwise, it will have green background colour. This does not have much significance now as there are no closed stats available. It will be added in the future versions.
▶ Watermark - Watermark appears only if valid key is not used or TRIAL access key is used.
Bit more details about open stats table here
⬜ Settings
⚪ Alert Key
Alert key is given for active subscribers. This key is required in order to set alerts or in order to run the script for more than 30 bars on single instrument without interruption. Not having alert key will not stop users from using the indicator once they acquire access - but it will only limit few capabilities. Key is not given for trial access.
Key is prompted every time users add indicator to chart. If you are provided with key, please use it instead of the TRIAL access key.
If you are using valid key,
You will see run timer in green instead of red background
No TRIAL ACCESS watermark on the chart.
⚪ Zigzag and pattern detection settings
⚪ Pattern Selection settings
⚪ Stats and Display
⚪ Colors and themes
⚪ Backtest Settings
Not important for now as there are no closed pattern stats. Kept for future usage. Will impact the timer widget.
⚪ Alerts
▶ Types and settings
▶Setting alerts is simple. When indicator is loaded on chart (Make sure you are using the right alert key), goto alerts and select the AHProjection from Condition dropdown. Update other parameters such as alert name, webhook details as required and press create
▶ Examples of alerts
⬜ Status Tracking
Script tracks two types of statuses.
⚪ Harmonic Pattern Projection Status : Tracks projection as a whole for each combination of X, A, B, C. Different states available are
Awaiting Activation : Any pattern projection when formed by default goes into Inactive State and hence set to Awaiting Activation.
Projection Active : Once price reach B, then pattern projection is considered active
Entry Reached : Once price reach the nearest PRZ level, it is considered as Entry reached. Status will remain as entry reached even if PRZ is removed and next PRZ level is yet to be reached.
Projection Invalidated : If price goes beyond C level, then pattern projection is considered invalidated. It can happen at any stage and even after successful completion of few PRZ ranges.
Projection Timed Out : If price keeps between PRZ and C for considerable time, it will timed out and removed from chart.
⚪ Harmonic Pattern Projection PRZ Status Tracks individual PRZs separately which may or may not belong to same patterns. Different states available are
Awaiting Activation : Any PRZ is considered inactive before price reaching the PRZ level.
Active : Once price reaches PRZ, it will become active. Active PRZs are highlighted with line fill on chart. Active PRZ also display success and stop levels. PRZ is not removed unless price hits one of these levels or the entire pattern is timed out.
Successful : If an active PRZ price reaches success level, then PRZ projection is considered successful. Once successful, PRZ will removed from chart
Failed : If an active PRZ price reaches stop level, then PRZ projection is considered failure. Once failed PRZ will be removed from chart.
Manual Harmonic Projections - With interactive inputsThis is another script involving interactive inputs. This is similar to Manual-Harmonic-Patterns-With-interactive-inputs . But, instead of taking XABCD and verifying if it confirms to any pattern, here we only take XABC and project all PRZs.
Example, upon adding the script to chart, it will prompt to select 4 points on chart by clicking on it. if we select X, A, B, C as shown in the chart below, we can see the projection of multiple PRZs. Mid of nearest PRZ is considered as D and rest of the pattern is drawn based on this. However, the pattern can have multiple PRZs. All overlapping PRZs are combined together and shown as one along with merged pattern labels. But, if there is gap between PRZs, they are shown separately.
If no projections found, then patterns and projections are not drawn. However, you can still see XABC lines on the chart.
Manual Harmonic Patterns - With interactive inputsThis script is a drawing tool which allows users to draw XABCD on the chart and script will tell whether there is any harmonic patterns on the drawings made. The script is based on interactive inputs and requires users to chose XABCD points.
Please note
This is not a scanner and it will not scan historical bars for harmonic patterns. This needs to be used rather as drawing tool instead.
Script will not check if selected pivots are correct. It assumes users to know how to select the right XABCD based on pivot high/lows. Bullish pattern will have X, B and D as pivot lows and A,C as pivot highs. Similarly bearish patterns will have X, B, D as pivot highs and A, C as pivot lows.
Script will not check for overflow conditions. For example, if price crosses, XB or BD line, then pattern is considered to be invalid. But, this check cannot be made in this script and we require users to be aware of this condition and select input accordingly.
Order of inputs should be in ascending order. X pivot should come before A and then, B, C, D and F. This again is users responsibility to select pivots in right order.
What happens after selecting XABCD?
If selected pattern is valid harmonic pattern, it will
Draw XABCD lines and labels
Fill harmonic triangles
Show PRZ box which shoes the name of valid patterns.
If it is not valid harmonic pattern, then users will see blank XABCD line without any PRZ or filled harmonic triangles.
Example:
1. When it is valid pattern
2. When it is not valid pattern
Auto TrendLines and Support Resistance - Ultimate [Trendoscope]Have been working on this script from sometime. Thought it would be right time to publish this now :)
This is enhanced and combined version of two open source scripts.
Auto-TrendLines-HeWhoMustNotBeNamed
Divergence-Support-Resistence
⬜ Major Enhancements to open source
▶ Concept of drawing trendlines remains same. But, logic has been altered to allow considering existing trendlines before scanning new one and also finding the strongest of all.
▶ Strength of trendlines now takes more factors into consideration such as weightage of each candles from two points with respect to a given trendline.
▶ Angle of the trendlines are calculated and considered for determination of overall trend.
▶ Trendlines come with invalidation point and trend definition also can be based on single trendline instead of multiple ones.
▶ Improved divergence and based support/resistance calculations which yield less but more significant levels.
⬜ Components
Below are the summary of indicator components
⚪ Trend Lines Summary Widget
This can have up-to 4 types of trend lines.
Uptrend Lower pivot based
Uptrend Higher pivot based
Downtrend Lower pivot based
Downtrend Higher pivot based
Direction of the lines dependent on slope of the trend as well. If angle is not steep, the trend lines are considered as neutral. Meanwhile, trend lines which are too steep are also ignored. Angle calculation depends on the ATR and Angle loopback input parameters which can be altered. Also TrendLines with negative Line strength or formed way too back are ignored based on the settings. Hence, it is perfectly normal to have less than 4 trend lines on charts at times.
⚪ S/R Summary Widget
This widget has been used in other indicators. Notations are same though there are logical improvements to derive only the high impact levels.
⬜ Settings
⚪ Trend Detection Settings
These are the settings used for scanning the trend lines. Summary of these settings are as below:
⚪ Pattern Detection Settings
The pattern detection settings help identify overall trend pattern and status based on the combination of higher and lower pivot trend lines.
Important bit here is the Sort Order which impacts the identification of overall trend. Available types are:
Distance : Sort based on distance from close price
LineStrength : Sort based on line strength of the trend line
Latest : Sort based on when the trend lines are formed.
⚪ Support/Resistance Settings
Base settings for calculating divergence based Support/Resistance.
⚪ Widgets
Widgets settings allow users to control display of Trend Lines and S/R summary widgets.
⚪ Alerts
Below are the settings for configuring alerts.
Alerts are formatted in Json for easier consumption via web-hook.
Crypto Volume/Strength ComparatorHello Traders,
Here is an attempt to perform comparative analysis between top cryptos based on strength (oscillator) and volume. Methodology used here is similar to Magic Number formula described in the post : Enhanced Magic Formula for fundamental analysis . But, instead of using fundamentals, we are making use of few technicals to derive similar outcome. Usage of the available stats will not be same as Magic number since we are using technicals.
⬜ Process
▶ Get crypto exchange based on prefix of instrument being used.
▶ For the given exchange, get data for all the tickers available in input fields.
▶ Calculate Oscillator, Momentum based on price for each tickers.
▶ Calculate Oscillator, Momentum based on volume for each tickers.
▶ Calculate Volatility for each tickers.
▶ Rank Price-Oscillator, Price-Momentum, Volume-Oscillator, Volume-Momentum, Volatility for each tickers.
▶ Calculate combined rank by adding up individual ranks.
▶ Calculate movement of rankings from bar to bar
▶ Sort tickers based on rank and populate them on table. Display direction of rankings.
⬜ Components
Display components are as follows:
⬜ Settings
Settings are pretty simple and straightforward
⬜ Calculations
▶ Oscillators : High values of oscillators are considered as ideal as the process is intended towards finding trend.
▶ Momentum : Momentum is calculated on the basis of Squeeze Momentum Indicator by @LazyBear.
▶ Volatility : Volatility is calculated on the basis of Williams Vix Fix by @ChrisMoody. Here too since we are in trend following mode, lower vix fix is considered ideal.
⬜ Few Notes
Tickers will show data only if selected exchange has them. Some tickers are not available in all exchanges. In that case, it will show NAN. This is kind of unavoidable as we need to have fixed size arrays for any calculations.
Indicator works only on crypto tickers which has valid exchange.
Tickers move through the rankings in real time. Background of all stats are based on gradient from green to red.
Tickers on top may not always have better long opportunity or tickers at bottom may not always be optimal for shorting. We need to consider how long the instrument may stay in the position or how fast it is moving in opposite direction. Hence, directions of the ranking movement are also shown on the table.
Auto TrendLines [HeWhoMustNotBeNamed]I started off with the intention of creating script to identify Wolfe wave projection. But, soon ran into problem with loops. Realized drawing wedge is more difficult than drawing converging triangle. Hence, took a step back and started working on wedges and triangle identification. Ended up with a messy output which looked like this.
Had to take another step back and hence decided to make Trendlines detection script and here we are :)
⬜ Process
▶ Scan pivots which are in trend. This means, series of pivot Highs or pivot lows either in ascending order or descending order.
▶ Draw trend line between each of the pivots in the trend series. For example, if there are 5 pivot high uptrend pivots, draw mXn lines between each of these points.
▶ Select the trend line which is more accurate or stronger. Accuracy is measured by number of candles/wicks touching the line and number of candles which fall outside the line. Stronger trendlines will touch more candles and pivots with less overflow.
▶ Remove all lines except the most accurate one for each direction.
At any point of time, you will see upto 4 trend lines in this script.
▶ Trendline joining pivot highs in uptrending condition
▶ Trendline joining pivot lows in uptrending condition
▶ Trendline joining pivot highs in downtrending condition
▶ Trendline joining pivot lows in downtrending conditions
The older line will remain until the new one comes through of same type. Hence, you will still be able to see uptrending high and low trend lines for downtrending instruments which are created way back!! Also, new trendlines replace old ones only if they are more stronger (connect to more pivots with less overflow)
⬜ Settings
Settings are simple.
User can select preferred Zigzag Length and Search Depth. Higher numbers for these two parameters will present longer term trends whereas lower numbers will display shorter ones.
Trend Lines controlls will allow users to enable/disable specific type of trend line, set color and line style to it.
⬜ Few Examples
▶ Uptrending Market : NASDAQ:NDX
▶ Downtrending Market : NYSE:BABA
▶ Ranging Market : NYSE:PLTR
Auto Harmonic Patterns - V2Hello traders. After getting good response to my earlier Harmonic patterns scripts, decided to deep dive a bit and make it bit more interesting and detailed.
Before I explain further on the script, few important things to note:
The script is very intensive and may often timeout or give memory error. If that happens, just reload the script. It may not work on smaller timeframes due to same reason. At this point, we cannot do much about it.
This should not be considered as strategy - but as a tool to make your harmonic based trades. Options are available to set your entry, stop and target levels based on your trading methods.
If there is timeout - try reducing the scope by disabling few zigzags and reducing Max depth from the settings.
Script does not show historical patterns. It will only show patterns which are currently in trade. This is done to reduce errors due to number of lines and labels. To track past patterns, you can either replay previous bars or use stats table.
After lots of deliberation, this script is released as protected script instead of invite only. Use it well :)
OVERVIEW
This script combines earlier two scripts defined on harmonic patterns:
Multi-ZigZag-Harmonic-Patterns
Multi-Level-ZigZag-Harmonic-Patterns
Merging these two the present script allows up to 4 Zigzags to be used and each zigzag comes with one multi level Zigzag. Logic of deriving multi level zigzag is described here: Multi-Level-Zigzag
On top of that each combination scans last 11 pivots (Max Depth) with all permutation combinations to come up with better pattern recognition. So, the complexity of the scan is 8 * (MaxDepth-4)!/2
In order to speed up the execution, you can chose to enable only the zigzags you are looking to trade instead of allowing all 4. Multi level zigzags cannot be enabled/disabled separately at this point.
INPUT PARAMETERS
Target and Stops
Entry Ratio : Minimal retracement from AD or CD (whichever is max) to enter into order
Stop Ratio : Retracement or extension from AC or AD (whichever is max) to stop or invalidate the trade. Negative values mean that stops are placed beyond D away from A/C whereas positive valus mean stops are placed between A/C and D. Please note Stop Ratio should be lesser than Entry Ratio. Wider the better for longevity of trade.
Target Ratios: Different points where profits can be taken. This is not optimized for strategy or pattern. To be used as per individual trading method.
Trailing Start Stage: This tells after what stage to start trailing stop loss. Trail will be based on difference between past subsequent levels. For example, if instrument is trading beyond Target 4, trail distance will be target4-target3
Pattern detection settings
Error Percent : Error threshold to be allowed for pattern recognition
Max Depth : Number of last pivots to consider for scanning patterns with m X n permutation. Increased numbers show more patterns but also slows down the script and may even lead to timeout.
Wait For Confirmation : Pattern recognition only happens on confirmed zigzags. Stats will show higher success rates and lesser patterns if this option is selected. That is because, there will be lag in identifying the patterns as confirming zigzags takes few bars.
Ignore if Entry Crossed : Only effective when Wait For Confirmation is enabled. If price has gone beyond entry when pattern has formed, system will ignore the pattern and do not try to plot it on charts.
Stats and Display
Show Trade Stats, Open Trades Stat Position, Closed Trades Stat Position can be used to display trade statistics and set different positions for tables display
Show Targets : Display/Hide target and stop levels
Show XABCD : Display/Hide XABCD marking on patterns
Show Ratios : Display/Hide harmonic ratios used for pattern recognition
Zigzags ( 1 - 4 )
L1 Length is primary zigzag length.
L2 Length is for deriving multi level zigzag based on L1
Patterns
Allows enabling and disabling several patterns. List includes:
Classic Patterns
Gartley
Bat
Butterfly
Crab
Deep Crab
Cypher
Shark
NenStar
Anti Patterns
Anti NenStar
Anti Shark
Anti Cypher
Anti Shark
Anti Crab
Anti Butterfly
Anti Bat
Anti Gartley
Navarro 200
Comprehensive list of patterns are listed here: Complete List of Harmonic Pattern Ratios
TRADE STATISTICS
Open Trade Stats consists of following fields
Zigzag - Zigzag length and level 2 length
Status - Current status of the trade. This includes - Awaiting Entry, In Trade, Target<1-4> Reached
X, A, B, C, D - price levels of X, A, B, C, D
Entry, Stop and Target Levels - These are same as what is shown on chart for present trades but presented in tabular way for better readability in case there are more number of trades.
Rows will have green background on bullish trades and red background color for bearish trades. Bullish and bearish colors can be set in Generic Color input settings. Text Color will be same as Zigzag line color which can be set in settings.
Closed Trade Stats consists of following fields
Overridden - these are patterns which are formed but overridden by other pattern based on the same XABC but with different D with better risk reward. Pattern is overridden only if entry/stop is not reached
Failed - These are the patterns which are successfully formed. But, price failed to hit entry before hitting stop. Hence, these signals are not taken as trade.
Stopped - These are the signals where price successfully hit Entry. But, failed to reach any of the targets before hitting Stop or Trailing Stop (If Trail Start Stage is set to Entry)
Target(1-4) - These numbers imply number of trades which successfully hit the respective target level but failed to hit next target level (Except target 4 which is the last target level)
Close stats show numbers based on Bullish and Bearish signals generated. It also shows numbers based on the zigzag length and level 2 length.
Multi Level ZigZag Harmonic PatternsLets make things bit complicated.
Main difference between this script and the earlier Multi Zigzag Harmonic Pattern is the calculation logic of Zigzag 2, 3 and 4
In the earlier script, all zigzags were plain and were calculated on the basis of different lengths. (Such as 5, 10, 15, 20). These were derived on the basis of Multi Zigzag indicator
In this script, Zigzag 2, 3 and 4 are calculated in slightly different way. They are calculated on the basis of previous zigzag. This means, Zigzag 1 will be the input for Zigzag2 calculation and Zigzag 2 will be the input for Zigzag3 and so on. This is demonstrated in the script - Multi Level Zigzag
One important parameter which is specific to this script is: UseZigZagChain
If checked:
Zigzag2 is formed based on Zigzag1
Zigzag3 is formed based on Zigzag2
Zigzag4 is formed based on Zigzag3
This can lead to patterns covering huge number of candles as this chaining causes exponential effect in each levels. (Effective length grows exponentially in each level)
If unchecked:
Zigzag2 is formed based on Zigzag1 (Same as when checked)
Zigzag3 is formed based on Zigzag1. But, length is set to zigzag2Length + zigzag3Length
Zigzag4 is formed based on Zigzag1. But, length is set to zigzag2Length + zigzag3Length + zigzag4Length
This reduces exponential increase of zigzag lengths over next levels.
Logical ratios of patterns are coded as below:
Notations:
Lines XABCD forms the pattern in all cases. (OXABCD in case of Three drives )
abc = BC retacement of AB, xab = AB retracement of XA and so on
ABCD Classic
0.618 <= abc <= 0.786
1.272 <= bcd <= 1.618
AB=CD
Price difference between AB and CD are equal
Time difference between AB and CD are equal
ABCD Extension
0.618 <= abc <= 0.786
1.272 <= AD/ BC (price) <= 1.618
Gartley
xab = 0.618
0.382 <= abc <= 0.886
1.272 <= bcd <= 1.618 OR xad = 0.786
Crab
0.382 <= xab <= 0.618
0.382 <= abc <= 0.886
2.24 <= bcd <= 3.618 OR xad = 1.618
Deep Crab
xab = 0.886
0.382 <= abc <= 0.886
2.0 <= bcd <= 3.618 OR xad = 1.618
Bat
0.382 <= xab <= 0.50
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR xad = 0.886
Butterfly
xab = 0.786
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR 1.272 <= xad <= 2.618
Shark
xab = 0.786
1.13 <= abc <= 1.618
1.618 <= bcd <= 2.24 OR 0.886 <= xad <= 1.13
Cypher
0.382 <= xab <= 0.618
1.13 <= abc <= 1.414
1.272 <= bcd <= 2.0 OR xad = 0.786
Three Drives
oxa = 0.618
1.27 <= xab <= 1.618
abc = 0.618
1.27 <= bcd <= 1.618
5-0
1.13 <= xab <= 1.618
1.618 <= abc <= 2.24
bcd = 0.5
Double Bottom
Last two pivot High Lows make W shape
Last Pivot Low is higher than previous Last Pivot Low.
Last Pivot High is lower than previous last Pivot High.
Price has not gone below Last Pivot Low
Price breaks out of last Pivot High to complete W shape
Double Top
Last two pivot High Lows make M shape
Last Pivot Low is higher than previous Last Pivot Low.
Last Pivot High is lower than previous last Pivot High.
Price has not gone above Last Pivot High
Price breaks out of last Pivot Low to complete M shape
Multi ZigZag Harmonic PatternsCombining Multizigzag with harmonic patterns - this script generates harmonic patterns based on multiple deapth zigzags.
Input parameter allows to chose which Zigzag to be included in pattern identification and set different length, line color, width and style for each Zigzag combinations.
Pattern rules are as below:
Gartley
xab = 0.618
0.382 <= abc <= 0.886
1.272 <= bcd <= 1.618 OR xad = 0.786
Crab
0.382 <= xab <= 0.618
0.382 <= abc <= 0.886
2.24 <= bcd <= 3.618 OR xad = 1.618
Deep Crab
xab = 0.886
0.382 <= abc <= 0.886
2.0 <= bcd <= 3.618 OR xad = 1.618
Bat
0.382 <= xab <= 0.50
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR xad = 0.886
Butterfly
xab = 0.786
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR 1.272 <= xad <= 2.618
Shark
xab = 0.786
1.13 <= abc <= 1.618
1.618 <= bcd <= 2.24 OR 0.886 <= xad <= 1.13
Cypher
0.382 <= xab <= 0.618
1.13 <= abc <= 1.414
1.272 <= bcd <= 2.0 OR xad = 0.786
Three Drives
oxa = 0.618
1.27 <= xab <= 1.618
abc = 0.618
1.27 <= bcd <= 1.618
5-0
1.13 <= xab <= 1.618
1.618 <= abc <= 2.24
bcd = 0.5
Related scripts are present here:
Auto Harmonic Patterns - Open SourceI may not be able to spend much time on the harmonic patterns and realized that there are not much open source scripts on them either. Hence, decided to release open source version which can be used by other developers for reference and build things on top of it.
Original script is protected and can be found here:
Logical ratios of patterns are coded as below:
Notations:
Lines XABCD forms the pattern in all cases. (OXABCD in case of Three drives )
abc = BC retacement of AB, xab = AB retracement of XA and so on
ABCD Classic
0.618 <= abc <= 0.786
1.272 <= bcd <= 1.618
AB=CD
Price difference between AB and CD are equal
Time difference between AB and CD are equal
ABCD Extension
0.618 <= abc <= 0.786
1.272 <= AD/ BC (price) <= 1.618
Gartley
xab = 0.618
0.382 <= abc <= 0.886
1.272 <= bcd <= 1.618 OR xad = 0.786
Crab
0.382 <= xab <= 0.618
0.382 <= abc <= 0.886
2.24 <= bcd <= 3.618 OR xad = 1.618
Deep Crab
xab = 0.886
0.382 <= abc <= 0.886
2.0 <= bcd <= 3.618 OR xad = 1.618
Bat
0.382 <= xab <= 0.50
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR xad = 0.886
Butterfly
xab = 0.786
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR 1.272 <= xad <= 2.618
Shark
xab = 0.786
1.13 <= abc <= 1.618
1.618 <= bcd <= 2.24 OR 0.886 <= xad <= 1.13
Cypher
0.382 <= xab <= 0.618
1.13 <= abc <= 1.414
1.272 <= bcd <= 2.0 OR xad = 0.786
Three Drives
oxa = 0.618
1.27 <= xab <= 1.618
abc = 0.618
1.27 <= bcd <= 1.618
5-0
1.13 <= xab <= 1.618
1.618 <= abc <= 2.24
bcd = 0.5
This script contains everything which original script has apart from stats. Use the original script if you are not developer looking for code reference and prefer having stats table.
I have also developed a strategy based on harmonic patterns which can be found here:
Auto Harmonic PatternsThis is my first attempt on plotting harmonic patterns based on zigzag. Initial version is still primitive and might need lot of time to mature into more formidable one. Will try to explain entire logic in the description. Please feel free to correct me if my understanding of any pattern and underlying logic is incorrect.
In the initial version,
Only immediate high lows of pivots are considered for calculation of patterns.
In case of ABCD Types, only one is shown at a time. Hence, disabling certain ABCD pattern types may result in different numbers.
Logic for double top/bottom is taken from previous script - Double top/bottom Ultimate . Though logic of confirmation and invalidation is not included
All other patterns which involve 4+ lines can coexist and often shown together.
Smaller timeframes may give error due to some pine limitations.
Error percent parameter is used for allowing minor deviation from the standard ratios.
Logical ratios of patterns are coded as below:
Notations:
Lines XABCD forms the pattern in all cases. (OXABCD in case of Three drives)
abc = BC retacement of AB, xab = AB retracement of XA and so on
ABCD Classic
0.618 <= abc <= 0.786
1.272 <= bcd <= 1.618
AB=CD
Price difference between AB and CD are equal
Time difference between AB and CD are equal
ABCD Extension
0.618 <= abc <= 0.786
1.272 <= AD/BC (price) <= 1.618
Gartley
xab = 0.618
0.382 <= abc <= 0.886
1.272 <= bcd <= 1.618 OR xad = 0.786
Crab
0.382 <= xab <= 0.618
0.382 <= abc <= 0.886
2.24 <= bcd <= 3.618 OR xad = 1.618
Deep Crab
xab = 0.886
0.382 <= abc <= 0.886
2.0 <= bcd <= 3.618 OR xad = 1.618
Bat
0.382 <= xab <= 0.50
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR xad = 0.886
Butterfly
xab = 0.786
0.382 <= abc <= 0.886
1.618 <= bcd <= 2.618 OR 1.272 <= xad <= 2.618
Shark
xab = 0.786
1.13 <= abc <= 1.618
1.618 <= bcd <= 2.24 OR 0.886 <= xad <= 1.13
Cypher
0.382 <= xab <= 0.618
1.13 <= abc <= 1.414
1.272 <= bcd <= 2.0 OR xad = 0.786
Three Drives
oxa = 0.618
1.27 <= xab <= 1.618
abc = 0.618
1.27 <= bcd <= 1.618
5-0
1.13 <= xab <= 1.618
1.618 <= abc <= 2.24
bcd = 0.5