Zigzag Chart Points█ OVERVIEW
This indicator displays zigzag based on high and low using latest pine script version 5 , chart.point which using time, index and price as parameters.
Pretty much a strip down using latest pine script function, without any use of library .
This allow pine script user to have an idea of simplified and cleaner code for zigzag.
█ CREDITS
LonesomeTheBlue
█ FEATURES
1. Label can be show / hide including text can be resized.
2. Hover to label, can see tooltip will show price and time.
3. Tooltip will show date and time for hourly timeframe and below while show date only for day timeframe and above.
█ NOTES
1. I admit that chart.point just made the code much more cleaner and save more time. I previously using user-defined type(UDT) which quite hassle.
2. I have no plan to extend this indicator or include alert just I thinking to explore log.error() and runtime.error() , which I may probably release in other publications.
█ HOW TO USE'
Pretty much similar inside mentioned references, which previously I created.
█ REFERENCES
1. Zigzag Array Experimental
2. Simple Zigzag UDT
3. Zig Zag Ratio Simplified
4. Cyclic RSI High Low With Noise Filter
5. Auto AB=CD 1 to 1 Ratio Experimental
Zig Zag Indicator
The Next Pivot [Kioseff Trading]Hello!
This script "The Next Pivot" uses various similarity measures to compare historical price sequences to the current price sequence!
Features
Find the most similar price sequence up to 100 bars from the current bar
Forecast price path up to 250 bars
Forecast ZigZag up to 250 bars
Spearmen
Pearson
Absolute Difference
Cosine Similarity
Mean Squared Error
Kendall
Forecasted linear regression channel
The image above shows/explains some of the indicator's capabilities!
The image above highlights the projected zig zag (pivots) pattern!
Colors are customizable (:
Additionally, you can plot a forecasted LinReg channel.
Should load times permit it, the script can search all bar history for a correlating sequence. This won't always be possible, contingent on the forecast length, correlation length, and the number of bars on the chart.
Reasonable Assessment
The script uses various similarity measures to find the "most similar" price sequence to what's currently happening. Once found, the subsequent price move (to the most similar sequence) is recorded and projected forward.
So,
1: Script finds most similar price sequence
2: Script takes what happened after and projects forward
While this may be useful, the projection is simply the reaction to a possible one-off "similarity" to what's currently happening. Random fluctuations are likely and, if occurring, similarities between the current price sequence and the "most similar" sequence are plausibly coincidental.
That said, if you have any ideas on cool features to add please let me know!
Thank you (:
Historical Pattern Matcher [Trendoscope]Do you believe in patterns and think price movements are more likely to follow historical patterns? If yes, this is an indicator for you.
🎲 Concept
The patterns in this script are not a named or known pattern. But, it can be any pattern that happen to repeat again and again over a period of time.
The indicator collects the following information over a period of time.
Collects all possible patterns for specified number of pivots based on relation between each pivot prices. (Default 6)
Keeps track of all the possible patterns for the given pivots and number of occurrences of such patterns over a period of time.
Collects the movement of next pivot (in terms of retracement ratio) after the pattern has formed for each occurrence.
Keeps track of the last occurrence of each pattern collected
And the indicator presents on chart following information
Current Pattern drawing based on last confirmed pivot.
Current Pattern drawing based on current unconfirmed pivot in the opposite direction.
Projection range based on historical retracement ratio for both patterns
Detailed info on last occurrence and overall occurrences.
Last occurrence of both confirmed and unconfirmed pivot patterns.
Please note that, if the patterns have not been repeated over a period, then it will not be shown on the screen. Hence, it is perfectly normal to not see any projection. This can happen when the current pattern has not been repeated any time before.
🎲 Details
When you load the indicator on the chart, you may see the following patterns and projections.
You may also notice, in the pattern details, information about the last occurrence of the pattern. If you scroll on your chart to the left to the given data and time, you can observe how the past occurrence of the pattern has formed and the price movement past that point.
For example, last occurrence of pattern based on confirmed pivot happened on 02-Jun-2023 00:00 UTC time
And last occurrence of pattern based on unconfirmed pivot happened on 27-Apr-2023 22:00 UTC time
🎲 Settings
Settings are minimal, and here is the meaning of them.
Most important setting here is the number of pivots forming the pattern.
🎲 Caution
The indicator is designed to present the projection based on historical occurrences of similar price pattern. This does not necessarily mean the patterns are supposed to be bullish or bearish. But, it will certainly give users an idea of what happened when similar price action presented historically.
Note to developers This script makes use of new pine script feature - maps
Visible Range Streaks of Unbroken Prior Highs/Lows [vnhilton](OVERVIEW)
This indicator keeps track of the number of unbroken prior highs/lows (unbroken being no price closes above/below the prior high/low). Great for entries and take profits. The indicator calculates on visible bars for convenience when looking back into the history without having to use bar replay, which those on the TradingView free plan cannot use intraday bar replay, so the visible range is a perfect work-around. The 2 minute chart above shows NASDAQ:NKLA on Thursday 13th July, 2023, with a significant level of $1.5 leading to a breakout. Streaks lower than 10 were hidden in the chart.
(FEATURES)
- Custom minimum streak size to start displaying plots (the smaller the size the more signals)
- Ability to show/hide numbers (that keep count of unbroken streaks), text signals (for when a streak is broken), break shapes (where the prior high/low was broken), and Zig Zag (lines between break shapes)
- Customisable Zig Zag line width, style, and colours (1 colour for a positive gradient line, and another for a negative gradient line)
- Customisable text signal text
- Customisable numbers, text signal, break shape, number label & text signal label colours
- Customisable number label, text signal label and break shape styles and sizes (number and text signal label share the same size)
Zigzag Trend-based Color [SteinG]Zigzag Indicator with Trend-based Color Coding and Info Table
This indicator is forked from Trendoscope's Recursive Zigzag
The Zigzag Indicator with Trend-based Color Coding and Info Table is a powerful tool for technical analysis, designed to help you identify significant price swings, visualize trends, and analyze pivot points with ease. This advanced indicator offers enhanced functionalities and improved visual representation.
The primary purpose of the Zigzag Indicator is to identify and highlight important price reversals, commonly referred to as pivot points, in a given chart. These pivot points are essential in recognizing trend changes and potential market turning points. With the Zigzag Indicator, you can quickly identify these pivotal moments and gain valuable insights into market dynamics.
One of the standout features of this indicator is the color coding applied to the Zigzag line, which intuitively reflects the trend associated with each pivot point. The color scheme is as follows:
- Green : Indicates an upward trend, representing a bullish movement in the price.
- Lime : Represents a retracement during an upward trend, indicating a temporary pullback before the uptrend resumes.
- Red : Signifies a downward trend, indicating a bearish movement in the price.
- Orange : Represents a retracement during a downward trend, indicating a temporary bounce before the downtrend resumes.
This color coding allows you to easily visualize the prevailing market sentiment and make more informed trading decisions accordingly.
In addition to the visual representation, the Zigzag Indicator also includes an informative table that provides essential details about each pivot point. The table presents the following information for each pivot point:
1. Pivot Value : The price level at which the pivot point occurs.
2. Direction : Indicates whether the pivot point represents an upward or downward trend.
3. Fibo Ratios : Displays the Fibonacci retracement levels between two consecutive pivot points, offering insights into potential support and resistance levels.
The inclusion of this comprehensive info table enables you to analyze pivot points more effectively, understand the underlying price dynamics, and identify key trading opportunities.
Volume Forks [Trendoscope]🎲 Volume Forks - Advanced Price Analysis with Recursive Auto-Pitchfork and Angled Volume Profile
The Volume Forks Indicator is a comprehensive research tool that combines two innovative techniques, Recursive Auto-Pitchfork and Angled Volume Profile . This indicator provides traders with valuable insights into price dynamics by integrating accurate pitchfork drawing and volume analysis over angled levels. The indicator does following things
Detects Pitchfork formations automatically on the chart over Recursive Zigzag
Instead of drawing forks based on fib levels, volume distribution over ABC of pitchfork is calculated and drawn in the direction of the handle.
🎲 Brief about Pitchfork
Pitchfork is drawn when price forms ABC pattern. Pitchfork draws a series of parallel lines in the direction of trend which can be used for support and resistance.
There are many methods of drawing pitchfork. In all cases, a line joining BC will make the base of pitchfork and fork lines are drawn from different points of the base. All the fork lines will be parallel. But, the handle of the base defines the direction of fork lines. Classification of pitchfork is mainly based on the starting and ending points of the handle.
🎲 Regular Types
Here, end of the handle is always fixed and it will be the mid point of B and C.
🎯 Andrews Pitchfork
Handle starts from A and joins the base at mid of B and C.
Forks are drawn based on fib ratios from the handle
🎯 Schiff Pitchfork
Handle starts from Bar of A and price of middle of AB and joins the base at mid of B and C
Forks are drawn based on fib ratios from the handle
🎯 Modified Schiff Pitchfork
Handle starts from mid of A and B and joins the base at mid of B and C
Forks are drawn based on fib ratios from the handle
🎲 Inside Types
Here, C will act as end of the handle which joins the Base BC .
🎯 Andrews Pitchfork (Inside)
Handle starts from A and joins the base at C
Forks are drawn based on fib ratios from the handle
🎯 Schiff Pitchfork (Inside)
Handle starts from Bar of A and price of (A+B)/2 and joins the base at C
Forks are drawn based on fib ratios from the handle
🎯 Modified Schiff Pitchfork (Inside)
Handle starts from mid of A and B and joins the base at C
Forks are drawn based on fib ratios from the handle
🎲 Brief about Pitchfork
The Angled Volume Profile technique expands on the concept of volume profile by measuring volume distribution levels over angled levels rather than just horizontal levels. By selecting a starting point and angle interactively, traders can assess volume distribution within specific price trends. This feature is particularly useful for analysing volume dynamics in trending markets.
🎲 Settings
Indicator settings include few things which determine the scanning of pitchforks and few which determines drawing of volume profile lines.
Please note that, due to pine limitations of 500 lines, if there are too many formations on the chart, volume profile may not appear correctly. If that happens, please reduce the number of volume forks per formation.
Recursive Micro Zigzag🎲 Overview
Zigzag is basic building block for any pattern recognition algorithm. This indicator is a research-oriented tool that combines the concepts of Micro Zigzag and Recursive Zigzag to facilitate a comprehensive analysis of price patterns. This indicator focuses on deriving zigzag on multiple levels in more efficient and enhanced manner in order to support enhanced pattern recognition.
The Recursive Micro Zigzag Indicator utilises the Micro Zigzag as the foundation and applies the Recursive Zigzag technique to derive higher-level zigzags. By integrating these techniques, this indicator enables researchers to analyse price patterns at multiple levels and gain a deeper understanding of market behaviour.
🎲 Concept:
Micro Zigzag Base : The indicator utilises the Micro Zigzag concept to capture detailed price movements within each candle. It allows for the visualisation of the sequential price action within the candle, aiding in pattern recognition at a micro level.
Basic implementation of micro zigzag can be found in this link - Micro-Zigzag
Recursive Zigzag Expansion : Building upon the Micro Zigzag base, the indicator applies the Recursive Zigzag concept to derive higher-level zigzags. Through recursive analysis of the Micro Zigzag's pivots, the indicator uncovers intricate patterns and trends that may not be evident in single-level zigzags.
Earlier implementations of recursive zigzag can be found here:
Recursive Zigzag
Recursive Zigzag - Trendoscope
And the libraries
rZigzag
ZigzagMethods
The major differences in this implementation are
Micro Zigzag Base - Earlier implementation made use of standard zigzag as base whereas this implementation uses Micro Zigzag as base
Not cap on Pivot depth - Earlier implementation was limited by the depth of level 0 zigzag. In this implementation, we are trying to build the recursive algorithm progressively so that there is no cap on the depth of level 0 zigzag. But, if we go for higher levels, there is chance of program timing out due to pine limitations.
These algorithms are useful in automatically spotting patterns on the chart including Harmonic Patterns, Chart Patterns, Elliot Waves and many more.
hidden & regular rsi divergenceThis is a divergence indicator that draws regular and hidden divergences based on the Zigzag indicator and RSI indicator. There are two degrees of Zigzag. So, in each Zigzag degree, there are two types of regular divergences and one type of hidden divergence.
👉(The logic is written in case of a bearish regular divergence. The opposite will apply for a bullish one.)
Type 1 of regular divergence (Logic 1):
Zigzag has to form a higher high. The highest RSI within both Zigzag legs must form lower highs, but the RSI values which are exactly at the Zigzag highs should not form lower highs.
Type 2 of regular divergence (Logic 2):
Zigzag has to form a higher high. The highest RSI within both Zigzag legs must form lower highs, and the RSI values which are exactly at the Zigzag highs should form lower highs.
👉(The logic is written in case of a bearish hidden divergence. The opposite will apply for a bullish one.)
Zigzag has to form a lower high. The highest RSI within both Zigzag legs must form higher highs.
👉There is also a filter that will be applied to all the divergences. It only shows the divergences whose corresponding RSI value was above/below a level (overbought level/oversold level).
Logic for regular divergences:
Bearish regular divergence's first high's (leftmost) RSI value should be greater than or equal to 70.
Bullish regular divergence's first low's (leftmost) RSI value should be less than or equal to 30.
Logic for hidden divergences:
Bearish hidden divergence's second high's (rightmost) RSI value should be greater than or equal to 70.
Bullish hidden divergence's second low's (rightmost) RSI value should be less than or equal to 30.
👉There is another feature also. This indicator colors the background based on whether the RSI is in a bullish or bearish range.
If it's within 80-60, the background will be colored green (this means that RSI is in a bullish range).
If it's within 40-20, the background will be colored red (this means that RSI is in a bearish range).
Zigzag Array ExperimentalThis is experimental script for zigzag which uses type, method and array. Not recommend for actual usage, for pine script study maybe useful.
In this experiment, I use type as coded below. It seems have limitation as specially when push as array. As Trading View recommendation, pushing float and int into array especially for type not guarantee to work. I agree with that. Preferred to push array as line or label especially for types.
// @type Used for point especially for array
// @field x int value for bar_index
// @field y float value for price
// @field sty label style
// @field col color for text label
// @field str high or low string
type point
int x = na
float y = na
string sty = na
color col = na
string str = na
I simulate the arrays as below.
var dirLine = array.new()
var dirLabel = array.new()
var dirPoint = array.new()
....
dirPoint.unshift(zigzag.createPoint(0))
dirLabel.unshift(zigzag.createLabel(fontSize, 0, true))
dirLine.unshift(zigzag.createLine(width, switchLine, 0, true))
Here are some results.
[JL] Supertrend Zone Pivot Point with zigzag fibThis is an open-source Pine script that generates a Supertrend Zone Pivot Point with Zigzag Fib indicator for TradingView. The indicator displays the Supertrend Zone, pivot points, and Fibonacci levels on the chart.
One of the unique features of this indicator is that it uses a Zigzag that does not repaint, ensuring accurate high and low points for the pivot points.
Another feature is that when the Supertrend is in an uptrend, only the highest points are taken as pivot points, and when it's in a downtrend, only the lowest points are taken as pivot points.
The Fibonacci levels are calculated based on the previous high and low pivot points, with labels displaying the corresponding levels on the chart.
The indicator also includes options to show/hide the Zigzag and Fibonacci levels.
Overall, this indicator is useful for identifying key pivot points and Fibonacci levels in the Supertrend Zone, providing valuable information for traders to make informed decisions.
Faytterro Market Structerethis indicator creates the market structure with a little delay but perfectly. each zigzag is always drawn from highest to lowest. It also signals when the market structure is broken. signals fade over time.
The table above shows the percentage distance of the price from the last high and the last low.
zigzags are painted green when making higher peaks, while lower peaks are considered downtrends and are painted red. In fact, the indicator is quite simple to understand and use.
"length" is used to change the frequency of the signal.
"go to past" is used to see historical data.
Please review the examples:
Recursive Zigzag [Trendoscope]Here is an another outcome of Object Oriented Zigzag and Pattern Ecosystem of Libraries.
We already have another implementation of recursive zigzag which makes use of earlier library rzigzag . Here in this example, we make use of similar logic but leverage the new type and method based Zigzag system libraries to derive the indicator.
🎲 Design Overview
Similar to Recursive Auto Pitchfork, here too the indicator code is around 50 lines. Whereas most of the heavy lifting is done by the libraries.
🎲 Base Libraries
Base libraries are those which does not have any dependency. They form basic structures which are later used in other libraries. These libraries need to be crafted carefully so that minimal updates are done later on. Any updates on these libraries will impact all the dependent libraries and scripts.
🎯 Drawing
DrawingTypes - Defines basic drawing types Point, Line, Label, Box, Linefill and related property types.
DrawingMethods - All the methods or functionality surrounding Basic types are defined here.
🎲 Layer 1 Libraries
These are the libraries which has direct dependency on base libraries.
🎯 Zigzag
ZigzagTypes - Types required for defining Zigzag and Divergence
ZigzagMethods - Methods associated with Zigzag Type definitions.
🎲Indicator
Indicator draws zigzags based on given length. And then recursively derives next level zigzags based on previous levels. As per the utility, indicator is useful in several ways
Visualising price structure based on zigzag pivots - which in turn can help visualise patterns.
Ability to add any oscillator makes it easy to spot divergences with choice of indicators.
Programmers can use the derived values to build complex algorithms such as automatic pattern recognition.
🎯 Settings
Settings are explained via tooltips. These are very much straight forward and directly related to zigzag, oscillators and divergence.
Simple Zigzag UDT█ OVERVIEW
This indicator displays zigzag based on high and low, which is using user-defined types (UDT) or objects .
█ CREDITS
LonesomeTheBlue
█ FEATURES
1. Label can be resized.
2. Label can be display either short (Eg : HH, LL, H, L, etc) and long (Eg : Higher Low, etc)
3. Color can be customized either contrast color of chart background, trend color or customized color.
█ EXAMPLES / USAGES
3 Zigzag for MTF Fib Alert [MsF]Japanese below / 日本語説明は英文の後にあります。
-------------------------
This indicator that automatically displays Fibonacci from each High & Low based on 3 Zigzags. It's useful for multi-timeframe analysis.
For example, Fibonacci calculated from the high and low prices (Zigzag 3 Period=100) of the upper timeframe can be displayed on the lower timeframe.
Also, you can set alerts for each Fibonacci point. It is useful when you are waiting for the price to return to the discount (50% or less) or the premium (50% or more) of the upper timeframe.
"Fib 1 - Crossing 0.00" … Trigger an alert when crossing the 0% line in Fibonacci of Zigzag1
"Fib 1 - Crossing 100.0" … Trigger an alert when crossing the 100% line in Fibonacci of Zigzag1
"Fib 1 - Crossing 23.6" … Trigger an alert when crossing the 23.6% line in Fibonacci of Zigzag1
"Fib 1 - Crossing 38.2" … Trigger an alert when crossing the 38.2% line in Fibonacci of Zigzag1
"Fib 1 - Crossing 50.0" … Trigger an alert when crossing the 50.0% line in Fibonacci of Zigzag1
"Fib 1 - Crossing 61.8" … Trigger an alert when crossing the 61.8% line in Fibonacci of Zigzag1
"Fib 1 - Crossing 76.4" … Trigger an alert when crossing the 76.4% line in Fibonacci of Zigzag1
*Same as Zigzag 1 and Zigzag 2 too.
"Choose Zig Zag Leg for fib" parameter means...
Latest : Calculate Fibonacci based on "the most recent Zigzag line".
Previous : Calculate Fibonacci based on "the previous Zigzag line".
-------------------------
3つのZigzagを元に各High&Lowからフィボナッチを自動で表示するインジケーターです。
Zigzagの期間を工夫することで、マルチタイムフレーム分析に役立ちます。
例えば、以下の設定とした場合:
Zigzag 1 Period … 8
Zigzag 2 Period … 25
Zigzag 3 Period … 100
上位時間足Zigzag(Period=100)の高値安値から形成されるフィボナッチを下位時間足に表示することができるのです。
また、このインジケーターではフィボナッチのポイント毎にアラートの設定が可能です。
上位時間足の割安価格(50%以下)や割高価格(50%以上)に価格が戻ってくるのを待っている時などに力を発揮してくれます。
"Fib 1 - Crossing 0.00" … Zigzag1のフィボナッチにおいて、0%ラインとクロスした場合にアラートを発報します
"Fib 1 - Crossing 100.0" … Zigzag1のフィボナッチにおいて、100%ラインとクロスした場合にアラートを発報します
"Fib 1 - Crossing 23.6" … Zigzag1のフィボナッチにおいて、23.6%ラインとクロスした場合にアラートを発報します
"Fib 1 - Crossing 38.2" … Zigzag1のフィボナッチにおいて、38.2%ラインとクロスした場合にアラートを発報します
"Fib 1 - Crossing 50.0" … Zigzag1のフィボナッチにおいて、50.0%ラインとクロスした場合にアラートを発報します
"Fib 1 - Crossing 61.8" … Zigzag1のフィボナッチにおいて、61.8%ラインとクロスした場合にアラートを発報します
"Fib 1 - Crossing 76.4" … Zigzag1のフィボナッチにおいて、76.4%ラインとクロスした場合にアラートを発報します
※Zigzag1およびZigzag2のフィボナッチも同様
"Choose Zig Zag Leg for fib"パラメータについて:
Latest … 一番新しいZigzagのライン(UpまたはDown)を元にフィボナッチを計算します。
Previous … ひとつ前のZigzagのライン(UpまたはDown)を元にフィボナッチを計算します。
Band-Zigzag - TrendFollower Strategy [Trendoscope]Strategy Time!!!
Have built this on my earlier published indicator Band-Zigzag-Trend-Follower . This is just one possible implementation of strategy on Band-Based-Zigzag .
🎲 Notes
Experimental prototype. Not financial advise and strategy not guaranteed to make money despite backtest results
Not created or tested for any specific instrument or timeframe
Test and adopt with own risk
🎲 Strategy
This is trend following strategy built based on Bands and Zigzag. Traits of trend following strategies are
Lower win rate (Yes, thats right)
High risk reward (Compensates low win rate)
Higher drawdown
If market is choppy, trend following methods suffer.
The script implements few points to overcome the negatives such as lower win rate and higher drawdown by actively assessing pivots on the direction of trend along. This helps us take regular profits and exit on time during the end of trend. Most of the other concepts are defined and explained in indicator - Band-Zigzag-Trend-Follower and Band-Based-Zigzag
Defining a trend following method is simple. Basic rule of trend following is Buy High and Sell Low (Yes, you heard it right). To explain further - methodology involve finding an established trend which is flying high and join the trend with proper risk and optimal stop. Once you get into the trade, you will not exit unless there is change in the trend. Or in other words, the parameters which you used to define trend has reversed and the trend is not valid anymore.
🎯 Using bands
When price breaks out of upper bands (example, Bollinger Band , Keltener Channel, or Donchian Channel), with a pre determined length and multiplier, we can consider the trend to be bullish and similarly when price breaks down the lower band, we can consider the trend to be bearish .
🎯 Using Pivots
Simple logic using zigzag or pivot points is that when price starts making higher highs and higher lows, we can consider this as uptrend. And when price starts making lower highs and lower lows, we can consider this as downtrend. There are few supertrend implementations I have published in the past based on zigzags and pivot points .
Drawbacks of both of these methods is that there will be too many fluctuations in both cases unless we increase the reference length. And if we increase the reference length, we will have higher drawdown.
🎯 Band Based Zigzag Method
Here we use bands to define our pivot high and pivot low - this makes sure that we are identifying trend only on breakouts as pivots are only formed on breakouts
Our method also includes pivot ratio to cross over 1.0 to be able to consider it as trend. This means, we are waiting for price also to make new high high or lower low before making the decision on trend. But, this helps us ignore smaller pivot movements due to the usage of bands.
I have also implemented few tricks such as sticky bands (Bands will not contract unless there is breakout) and Adaptive Bands (Band will not expand unless price is moving in the direction of band). This makes the trend following method very robust.
To avoid fakeouts, we also use percentB of high/low in comparison with price retracement to define breakout.
🎲 Settings
Settings are fairly simpler and are explained as below. You will find most of the required information in tooltips.
Zig Zag Stochastic (ZZS)The "Zig Zag Stochastic" indicator is an indicator that uses a combination of zigzag pivot points and exponential smoothing to calculate a stochastic-like oscillator.
The indicator starts by identifying pivot high and pivot low points in the price data using the Zigzag indicator. These pivot points are then used to calculate the scale_price, which is a ratio of the current close price to the range between the current pivot high and pivot low.
Next, the scale_price is smoothed using exponential smoothing. The user can input the desired length of the smoothing period, with a default value of 14. If the user sets the smoothing length to 0, the indicator will automatically calculate the optimal smoothing length using the MAMA period calculation from the Dominant Cycle Estimators library.
The smoothed scale_price is then used to calculate two lines: the K-line and the D-line, both of which are also smoothed using exponential smoothing. The K-line is the main oscillator line and is similar to the %K line in a traditional stochastic oscillator. The D-line is a signal line, similar to the %D line in a traditional stochastic oscillator.
The indicator plots the smoothed scale_price, the K-line, and the D-line. Additionally, it includes horizontal lines at the 80 and 20 levels, and fills the area between them to help identify overbought and oversold conditions.
Band-Zigzag Based Trend FollowerWe defined new method to derive zigzag last month - which is called Channel-Based-Zigzag . This script is an example of one of the use case of this method.
🎲 Trend Following
Defining a trend following method is simple. Basic rule of trend following is Buy High and Sell Low (Yes, you heard it right). To explain further - methodology involve finding an established trend which is flying high and join the trend with proper risk and optimal stop. Once you get into the trade, you will not exit unless there is change in the trend. Or in other words, the parameters which you used to define trend has reversed and the trend is not valid anymore.
Few examples are:
🎯 Using bands
When price breaks out of upper bands (example, Bollinger Band, Keltener Channel, or Donchian Channel), with a pre determined length and multiplier, we can consider the trend to be bullish and similarly when price breaks down the lower band, we can consider the trend to be bearish.
Here are few examples where I have used bands for identifying trend
Band-Based-Supertrend
Donchian-Channel-Trend-Filter
🎯 Using Pivots
Simple logic using zigzag or pivot points is that when price starts making higher highs and higher lows, we can consider this as uptrend. And when price starts making lower highs and lower lows, we can consider this as downtrend. There are few supertrend implementations I have published in the past based on zigzags and pivot points.
Adoptive-Supertrend-Pivots
Zigzag-Supertrend
Drawbacks of both of these methods is that there will be too many fluctuations in both cases unless we increase the reference length. And if we increase the reference length, we will have higher drawdown.
🎲 Band Based Zigzag Method
Band Based Zigzag will help overcome these issues by combining both the methods.
Here we use bands to define our pivot high and pivot low - this makes sure that we are identifying trend only on breakouts as pivots are only formed on breakouts.
Our method also includes pivot ratio to cross over 1.0 to be able to consider it as trend. This means, we are waiting for price also to make new high high or lower low before making the decision on trend. But, this helps us ignore smaller pivot movements due to the usage of bands.
I have also implemented few tricks such as sticky bands (Bands will not contract unless there is breakout) and Adaptive Bands (Band will not expand unless price is moving in the direction of band). This makes the trend following method very robust.
To avoid fakeouts, we also use percentB of high/low in comparison with price retracement to define breakout.
🎲 The indicator
The output of indicator is simple and intuitive to understand.
🎯 Trend Criteria
Uptrend when last confirmed pivot is pivot high and has higher retracement ratio than PercentB of High. Else, considered as downtrend.
Downtrend when last confirmed pivot is pivot low and has higher retracement ratio than PercentB of High. Else, considered as uptrend.
🎯 Settings
Settings allow you to select the band type and parameters used for calculating zigzag and then trend. Also has few options to hide the display.
Multi-Timeframe MA Based Zigzag[liwei666]🎲 Overview
🎯 This Zigzag indicator build based on different MA such as EMA/HMA/RMA/SMA, support multi-timeframe setting .
you can get customer zigzag indicator by change short/long ma length and high-timeframe config(5m/15m/30m/1h/2h) in any symbol.
🎲 Indicator design logic
🎯 entired logic is simple and code looks complex, I‘ll explain core logic here, code already equipped with detailed comments.
1. use close-in EMA's highest/lowest value mark as SWING High/Low when EMA crossover/under, not use func ta.pivothigh()/ta.pivotlow()
2. when EMA crossover/under plot a char as signal like ●/❄/▲, crossover get blue char crossunder get red char
3. latest zigzag line is not drawn until EMA is turned (crossover/under), but signal is realtime
4. you can see diff zigzag structure when you open high-timeframe config, then find regular pattern benefit your trading.
🎲 Settings
🎯 there are 3 group properties in script, just focus on 5 properties in 'GRP1' ,
'GRP2' and 'GRP3' are display config.
'GRP1':
MA_Type: MA type you can choose(EMA/RMA/SMA/HMA/WMA), default is EMA
short_ma_len: short MA length of your current timeframe on chart
long_ma_len: long MA length of your current timeframe on chart
htf_ma_len: MA length of high timeframe, MA type same as 'MA_Type' config
htf_ma_tf: high timeframe ma length, 15/30/60/120 minute
'GRP2':
• show_short_zz • show_long_zz • show_htf_zz:
'GRP3':
• show_short_ma_line • show_short_ma_signal
• show_long_ma_line • show_long_ma_signal
• show_htf_ma_line • show_htf_ma_signal
🎲 Usage
🎯 As we know, MA based signal usually worked fine in trend market , low volatility is unprofitable.
🎯 One of pattern as the chart show below.
1. success example : after a blue ▲ signal, entry long when blue ● signal appear, marked with green box.
2. failed example: after a blue ▲ signal, a red ▼ signal appear, marked with white box.
🎯 BoS(Break of Structure) based on ma zigzag is a good idea I'm implementing, it will be published in next script.
Additionally, I plan to publish 20 profitable strategies in 2023; this indicatior not one of them,
let‘s witness it together!
Hope this indicator will be useful for you :)
enjoy! 🚀🚀🚀
Wolfe Strategy [Trendoscope]Hello Everyone,
Wish you all Merry X-Mas and happy new year. Lets start 2023 with fresh new strategy built on Wolfe Indicator. Details of the indicator can be found here
🎲 Wolfe Concept
Wolfe concept is simple. Whenever a wedge is formed, draw a line joining pivot 1 and 4 as shown in the chart below:
For simplicity, we will only consider static value for Target and Stop. But, entry is done based on breaking the triangle. Revised strategy looks something like this:
🎲 Settings
Settings are simple and details of each are provided via tooltips.
Out of these, the most important one is minimum risk reward ratio. If you set lower risk reward threshold then losing few trades may generate more losses than more winning trades. Similarly higher value will filter out most of the trades and may not work efficiently. Default value set to 1 to make sure optimal risk reward is present before placing trade. Also make note that since the entry bar is always moving towards stop, as and when pattern progress, the RR will also increase. Hence, a pattern which is below RR threshold may become good to trade at certain point of time in future.
🎲 Strategy Parameters
Default strategy parameters are initialised via definition. Margins are set to 100 to disable leveraged trades. Appropriate values are chosen for other parameters. These can be altered based on individual strategy and trading plan.
As the strategy concentrates on the single pattern, number of trades generated are comparatively less. But, there is chance to increase the algorithm further to catch more such patterns on larger scale. Will try to work on them in next versions.
🎲 Pine Strategy limitations
Backtest can only be done on one direction as pine strategy cannot have both long and short open trades together. Hence, it is mandatory to chose either long/short trades in settings.
Since pyramiding is limited to 1, there is possibility of a pattern not generating trade even though the entry conditions are met. They are just based on pine limitations and not necessarily mean patterns are not good for placing trades.
ZigCycleBarCount [MsF]Japanese below / 日本語説明は英文の後にあります。
Based on "ZigZag++" indicator by DevLucem. Thanks for the great indicator.
-------------------------
This indicator that displays the candle count (bar count) at the peaks of Zigzag .
It also displays the price of the peaks.
You can easily count candles (bars) from peak to peak. Helpful for candles (bars) in cycle theory.
This logic of the indicator is based from the mt4 zigzag indicator .
Parameter:
Depth = depth (price range)
Backstep = Period
Deviation = Percentage of how much the price has wrapped around the previous line.
Example:
Depth = 12
Backstep = 3
Deviation = 5
In this case, the price range is updated by 12 pips or more (Depth), and after 3 or more candlesticks line up (Backstep), if the price deviates from the previous line by 5% or more (Deviation), a peak is added.
-------------------------
Zigzagの頂点にローソクカウント(バーカウント)を表示するインジケータです。
頂点の価格も表示します。
頂点から頂点までのローソク(バー)を容易にカウントすることができます。
サイクル理論のローソク(バー)に役立ちます。
Zigzagロジック自体はMT4のzigzagインジケータを流用しています。
<パラメータ>
Depth=深さ(値幅)
Backstep=期間
Deviation=価格がどれだけ直前のラインの折り返したかの割合
例:
Depth=12
Backstep=3
Deviation=5
この場合、値幅を12pips以上更新し(Depth)、ローソク足が3本以上並んだ後(Backstep)、価格が直前のラインの5%以上折り返せば(Deviation)、頂点を付けます。
<表示オプション>
Label_Style = "TEXT"…テキスト表示、"BALLOON"…吹き出し表示
Next Pivot Projection [Trendoscope]Still experimental. Extending further on the divergence backtest results - in this script we try to project next 2 pivots (including one unconfirmed pivot)
🎲 Previous experiments
1. Divergence-Backtester
2. Divergence-Backtester-V2
🎲 Additions
Apart from collecting the stats on number of occurrences of HH, HL, LH, LL - this script also keeps track of average ratio for each levels and average bars.
Based on these data, we try to calculate the next pivot projections including possible bar and price.
Cloud covering the candles indicate historical levels of average HH, HL, LH, LL projections.
Hover on projection labels to find more details in tooltips.
🎲 Overall method in a nutshell
🎲 Going bit deeper
🎯 Unconfirmed Pivot and its projection - Last pivot of the zigzag is always unconfirmed. Meaning, it can potentially repaint based on further price movements. But, projection of the unconfirmed pivot will not change as it will be based on previous two pivots - both of which are confirmed.
🎯 Next Pivot Projection - Next pivot is projected based on last two pivots - which include last unconfirmed pivot. Hence, these projections can potentially repaint based on the last pivot repaint.
🎯 Historical projections displayed as cloud - Historical projection values are displayed as cloud around pivots.
A cloud above represents area from average lower high range to average higher high range. Cloud color is green if average ratio of pivot high is more than 1. Red Otherwise.
A cloud below represents area from average higher low range to average lower low range. Cloud color is red if average ratio of pivot high is more than 1. Green otherwise
Divergence Backtester - V2Further attempts to study divergence impact on price in shorter terms.
Previous study can be found here:
In this script, we are trying to gather the stats based on last two pivot state together. For example, Individual table of Pivot High Projection is as explained below:
But, by looking at the bigger picture, we can further estimate following things regarding the current unconfirmed pivot and the new pivot which is yet to be formed.
Divergence BacktesterThere is n number of possible ways in which we can backtest divergence and this is just a start :)
In this script, we are trying to count how many times the pivots made HH, HL, LH, LL after a particular divergence state.
An example of using data is as below:
The script keeps track of each pivot sentiment and resulting next pivot state. As mentioned in the chart snapshot, we can look at two of the previous pivot states and collect stats on how each of these state impacted price action.
As mentioned before, this is just tip of iceberg. Further combinations for which we can do backtest are:
1. m X n combinations of last pivot and last to last pivot divergence state
2. divergence combined with double divergence state.
Only issue to explore further is lack of space on the chart as tables can take up huge space.
PS: As you can see based on historical stats, probability of divergence impacting the change of trend is very low in most cases.