SuperBollingerTrend (Expo)█ Overview
The SuperBollingerTrend indicator is a combination of two popular technical analysis tools, Bollinger Bands, and SuperTrend. By fusing these two indicators, SuperBollingerTrend aims to provide traders with a more comprehensive view of the market, accounting for both volatility and trend direction. By combining trend identification with volatility analysis, the SuperBollingerTrend indicator provides traders with valuable insights into potential trend changes. It recognizes that high volatility levels often accompany stronger price momentum, which can result in the formation of new trends or the continuation of existing ones.
█ How Volatility Impacts Trends
Volatility can impact trends by expanding or contracting them, triggering trend reversals, leading to breakouts, and influencing risk management decisions. Traders need to analyze and monitor volatility levels in conjunction with trend analysis to gain a comprehensive understanding of market dynamics.
█ How to use
Trend Reversals: High volatility can result in more dramatic price fluctuations, which may lead to sharp trend reversals. For example, a sudden increase in volatility can cause a bullish trend to transition into a bearish one, or vice versa, as traders react to significant price swings.
Volatility Breakouts: Volatility can trigger breakouts in trends. Breakouts occur when the price breaks through a significant support or resistance level, indicating a potential shift in the trend. Higher volatility levels can increase the likelihood of breakouts, as they indicate stronger market momentum and increased buying or selling pressure. This indicator triggers when the volatility increases, and if the price is near a key level when the indicator alerts, it might trigger a great trend.
█ Features
Peak Signal Move
The indicator calculates the peak price move for each ZigZag and displays it under each signal. This highlights how much the market moved between the signals.
Average ZigZag Move
All price moves between two signals are stored, and the average or the median is calculated and displayed in a table. This gives traders a great idea of how much the market moves on average between two signals.
Take Profit
The Take Profit line is placed at the average or the median price move and gives traders a great idea of what they can expect in average profit from the latest signals.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
زيجزاج
[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.
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.
PitchforkMethodsLibrary "PitchforkMethods"
Methods associated with Pitchfork and Pitchfork Drawing. Depends on the library PitchforkTypes for Pitchfork/PitchforkDrawing objects which in turn use DrawingTypes for basic objects Point/Line/LineProperties. Also depends on DrawingMethods for related methods
tostring(this)
Converts PitchforkTypes/Fork object to string representation
Parameters:
this : PitchforkTypes/Fork object
Returns: string representation of PitchforkTypes/Fork
tostring(this)
Converts Array of PitchforkTypes/Fork object to string representation
Parameters:
this : Array of PitchforkTypes/Fork object
Returns: string representation of PitchforkTypes/Fork array
tostring(this, sortKeys, sortOrder)
Converts PitchforkTypes/PitchforkProperties object to string representation
Parameters:
this : PitchforkTypes/PitchforkProperties object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
Returns: string representation of PitchforkTypes/PitchforkProperties
tostring(this, sortKeys, sortOrder)
Converts PitchforkTypes/PitchforkDrawingProperties object to string representation
Parameters:
this : PitchforkTypes/PitchforkDrawingProperties object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
Returns: string representation of PitchforkTypes/PitchforkDrawingProperties
tostring(this, sortKeys, sortOrder)
Converts PitchforkTypes/Pitchfork object to string representation
Parameters:
this : PitchforkTypes/Pitchfork object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
Returns: string representation of PitchforkTypes/Pitchfork
createDrawing(this)
Creates PitchforkTypes/PitchforkDrawing from PitchforkTypes/Pitchfork object
Parameters:
this : PitchforkTypes/Pitchfork object
Returns: PitchforkTypes/PitchforkDrawing object created
createDrawing(this)
Creates PitchforkTypes/PitchforkDrawing array from PitchforkTypes/Pitchfork array of objects
Parameters:
this : array of PitchforkTypes/Pitchfork object
Returns: array of PitchforkTypes/PitchforkDrawing object created
draw(this)
draws from PitchforkTypes/PitchforkDrawing object
Parameters:
this : PitchforkTypes/PitchforkDrawing object
Returns: PitchforkTypes/PitchforkDrawing object drawn
delete(this)
deletes PitchforkTypes/PitchforkDrawing object
Parameters:
this : PitchforkTypes/PitchforkDrawing object
Returns: PitchforkTypes/PitchforkDrawing object deleted
delete(this)
deletes underlying drawing of PitchforkTypes/Pitchfork object
Parameters:
this : PitchforkTypes/Pitchfork object
Returns: PitchforkTypes/Pitchfork object deleted
delete(this)
deletes array of PitchforkTypes/PitchforkDrawing objects
Parameters:
this : Array of PitchforkTypes/PitchforkDrawing object
Returns: Array of PitchforkTypes/PitchforkDrawing object deleted
delete(this)
deletes underlying drawing in array of PitchforkTypes/Pitchfork objects
Parameters:
this : Array of PitchforkTypes/Pitchfork object
Returns: Array of PitchforkTypes/Pitchfork object deleted
clear(this)
deletes array of PitchforkTypes/PitchforkDrawing objects and clears the array
Parameters:
this : Array of PitchforkTypes/PitchforkDrawing object
Returns: void
clear(this)
deletes array of PitchforkTypes/Pitchfork objects and clears the array
Parameters:
this : Array of Pitchfork/Pitchfork object
Returns: void
PitchforkTypesLibrary "PitchforkTypes"
User Defined Types to be used for Pitchfork and Drawing elements of Pitchfork. Depends on DrawingTypes for Point, Line, and LineProperties objects
PitchforkDrawingProperties
Pitchfork Drawing Properties object
Fields:
extend : If set to true, forks are extended towards right. Default is true
fill : Fill forklines with transparent color. Default is true
fillTransparency : Transparency at which fills are made. Only considered when fill is set. Default is 80
forceCommonColor : Force use of common color for forks and fills. Default is false
commonColor : common fill color. Used only if ratio specific fill colors are not available or if forceCommonColor is set to true.
PitchforkDrawing
Pitchfork drawing components
Fields:
medianLine : Median line of the pitchfork
baseLine : Base line of the pitchfork
forkLines : fork lines of the pitchfork
linefills : Linefills between forks
Fork
Fork object property
Fields:
ratio : Fork ratio
forkColor : color of fork. Default is blue
include : flag to include the fork in drawing. Default is true
PitchforkProperties
Pitchfork Properties
Fields:
forks : Array of Fork objects
type : Pitchfork type. Supported values are "regular", "schiff", "mschiff", Default is regular
inside : Flag to identify if to draw inside fork. If set to true, inside fork will be drawn
Pitchfork
Pitchfork object
Fields:
a : Pivot Point A of pitchfork
b : Pivot Point B of pitchfork
c : Pivot Point C of pitchfork
properties : PitchforkProperties object which determines type and composition of pitchfork
dProperties : Drawing properties for pitchfork
lProperties : Common line properties for Pitchfork lines
drawing : PitchforkDrawing object
ZigzagMethodsLibrary "ZigzagMethods"
Object oriented implementation of Zigzag methods. Please refer to ZigzagTypes library for User defined types used in this library
tostring(this, sortKeys, sortOrder, includeKeys)
Converts ZigzagTypes/Pivot object to string representation
Parameters:
this : ZigzagTypes/Pivot
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of ZigzagTypes/Pivot
tostring(this, sortKeys, sortOrder, includeKeys)
Converts Array of Pivot objects to string representation
Parameters:
this : Pivot object array
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of Pivot object array
tostring(this)
Converts ZigzagFlags object to string representation
Parameters:
this : ZigzagFlags object
Returns: string representation of ZigzagFlags
tostring(this, sortKeys, sortOrder, includeKeys)
Converts ZigzagTypes/Zigzag object to string representation
Parameters:
this : ZigzagTypes/Zigzagobject
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of ZigzagTypes/Zigzag
calculate(this, ohlc, indicators, indicatorNames)
Calculate zigzag based on input values and indicator values
Parameters:
this : Zigzag object
ohlc : Array containing OHLC values. Can also have custom values for which zigzag to be calculated
indicators : Array of indicator values
indicatorNames : Array of indicator names for which values are present. Size of indicators array should be equal to that of indicatorNames
Returns: current Zigzag object
calculate(this)
Calculate zigzag based on properties embedded within Zigzag object
Parameters:
this : Zigzag object
Returns: current Zigzag object
nextlevel(this)
Calculate Next Level Zigzag based on the current calculated zigzag object
Parameters:
this : Zigzag object
Returns: Next Level Zigzag object
clear(this)
Clears zigzag drawings array
Parameters:
this : array
Returns: void
drawfresh(this)
draws fresh zigzag based on properties embedded in ZigzagDrawing object
Parameters:
this : ZigzagDrawing object
Returns: ZigzagDrawing object
drawcontinuous(this)
draws zigzag based on the zigzagmatrix input
Parameters:
this : ZigzagDrawing object
Returns:
ZigzagTypesLibrary "ZigzagTypes"
Zigzag related user defined types. Depends on DrawingTypes library for basic types
Indicator
Indicator is collection of indicator values applied on high, low and close
Fields:
indicatorHigh : Indicator Value applied on High
indicatorLow : Indicator Value applied on Low
PivotCandle
PivotCandle represents data of the candle which forms either pivot High or pivot low or both
Fields:
_high : High price of candle forming the pivot
_low : Low price of candle forming the pivot
length : Pivot length
pHighBar : represents number of bar back the pivot High occurred.
pLowBar : represents number of bar back the pivot Low occurred.
pHigh : Pivot High Price
pLow : Pivot Low Price
indicators : Array of Indicators - allows to add multiple
Pivot
Pivot refers to zigzag pivot. Each pivot can contain various data
Fields:
point : pivot point coordinates
dir : direction of the pivot. Valid values are 1, -1, 2, -2
level : is used for multi level zigzags. For single level, it will always be 0
ratio : Price Ratio based on previous two pivots
indicatorNames : Names of the indicators applied on zigzag
indicatorValues : Values of the indicators applied on zigzag
indicatorRatios : Ratios of the indicators applied on zigzag based on previous 2 pivots
ZigzagFlags
Flags required for drawing zigzag. Only used internally in zigzag calculation. Should not set the values explicitly
Fields:
newPivot : true if the calculation resulted in new pivot
doublePivot : true if the calculation resulted in two pivots on same bar
updateLastPivot : true if new pivot calculated replaces the old one.
Zigzag
Zigzag object which contains whole zigzag calculation parameters and pivots
Fields:
length : Zigzag length. Default value is 5
numberOfPivots : max number of pivots to hold in the calculation. Default value is 20
offset : Bar offset to be considered for calculation of zigzag. Default is 0 - which means calculation is done based on the latest bar.
level : Zigzag calculation level - used in multi level recursive zigzags
zigzagPivots : array which holds the last n pivots calculated.
flags : ZigzagFlags object which is required for continuous drawing of zigzag lines.
ZigzagObject
Zigzag Drawing Object
Fields:
zigzagLine : Line joining two pivots
zigzagLabel : Label which can be used for drawing the values, ratios, directions etc.
ZigzagProperties
Object which holds properties of zigzag drawing. To be used along with ZigzagDrawing
Fields:
lineColor : Zigzag line color. Default is color.blue
lineWidth : Zigzag line width. Default is 1
lineStyle : Zigzag line style. Default is line.style_solid.
showLabel : If set, the drawing will show labels on each pivot. Default is false
textColor : Text color of the labels. Only applicable if showLabel is set to true.
maxObjects : Max number of zigzag lines to display. Default is 300
xloc : Time/Bar reference to be used for zigzag drawing. Default is Time - xloc.bar_time.
ZigzagDrawing
Object which holds complete zigzag drawing objects and properties.
Fields:
properties : ZigzagProperties object which is used for setting the display styles of zigzag
drawings : array which contains lines and labels of zigzag drawing.
zigzag : Zigzag object which holds the calculations.
DrawingMethodsLibrary "DrawingMethods"
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Point object to string representation
Parameters:
this : DrawingTypes/Point object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Point
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/LineProperties object to string representation
Parameters:
this : DrawingTypes/LineProperties object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/LineProperties
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Line object to string representation
Parameters:
this : DrawingTypes/Line object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Line
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/LabelProperties object to string representation
Parameters:
this : DrawingTypes/LabelProperties object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/LabelProperties
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Label object to string representation
Parameters:
this : DrawingTypes/Label object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Label
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Linefill object to string representation
Parameters:
this : DrawingTypes/Linefill object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Linefill
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/BoxProperties object to string representation
Parameters:
this : DrawingTypes/BoxProperties object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/BoxProperties
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/BoxText object to string representation
Parameters:
this : DrawingTypes/BoxText object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/BoxText
tostring(this, sortKeys, sortOrder, includeKeys)
Converts DrawingTypes/Box object to string representation
Parameters:
this : DrawingTypes/Box object
sortKeys : If set to true, string output is sorted by keys.
sortOrder : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
includeKeys : Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
Returns: string representation of DrawingTypes/Box
delete(this)
Deletes line from DrawingTypes/Line object
Parameters:
this : DrawingTypes/Line object
Returns: Line object deleted
delete(this)
Deletes label from DrawingTypes/Label object
Parameters:
this : DrawingTypes/Label object
Returns: Label object deleted
delete(this)
Deletes Linefill from DrawingTypes/Linefill object
Parameters:
this : DrawingTypes/Linefill object
Returns: Linefill object deleted
delete(this)
Deletes box from DrawingTypes/Box object
Parameters:
this : DrawingTypes/Box object
Returns: DrawingTypes/Box object deleted
delete(this)
Deletes lines from array of DrawingTypes/Line objects
Parameters:
this : Array of DrawingTypes/Line objects
Returns: Array of DrawingTypes/Line objects
delete(this)
Deletes labels from array of DrawingTypes/Label objects
Parameters:
this : Array of DrawingTypes/Label objects
Returns: Array of DrawingTypes/Label objects
delete(this)
Deletes linefill from array of DrawingTypes/Linefill objects
Parameters:
this : Array of DrawingTypes/Linefill objects
Returns: Array of DrawingTypes/Linefill objects
delete(this)
Deletes boxes from array of DrawingTypes/Box objects
Parameters:
this : Array of DrawingTypes/Box objects
Returns: Array of DrawingTypes/Box objects
clear(this)
clear items from array of DrawingTypes/Line while deleting underlying objects
Parameters:
this : array
Returns: void
clear(this)
clear items from array of DrawingTypes/Label while deleting underlying objects
Parameters:
this : array
Returns: void
clear(this)
clear items from array of DrawingTypes/Linefill while deleting underlying objects
Parameters:
this : array
Returns: void
clear(this)
clear items from array of DrawingTypes/Box while deleting underlying objects
Parameters:
this : array
Returns: void
draw(this)
Creates line from DrawingTypes/Line object
Parameters:
this : DrawingTypes/Line object
Returns: line created from DrawingTypes/Line object
draw(this)
Creates lines from array of DrawingTypes/Line objects
Parameters:
this : Array of DrawingTypes/Line objects
Returns: Array of DrawingTypes/Line objects
draw(this)
Creates label from DrawingTypes/Label object
Parameters:
this : DrawingTypes/Label object
Returns: label created from DrawingTypes/Label object
draw(this)
Creates labels from array of DrawingTypes/Label objects
Parameters:
this : Array of DrawingTypes/Label objects
Returns: Array of DrawingTypes/Label objects
draw(this)
Creates linefill object from DrawingTypes/Linefill
Parameters:
this : DrawingTypes/Linefill objects
Returns: linefill object created
draw(this)
Creates linefill objects from array of DrawingTypes/Linefill objects
Parameters:
this : Array of DrawingTypes/Linefill objects
Returns: Array of DrawingTypes/Linefill used for creating linefills
draw(this)
Creates box from DrawingTypes/Box object
Parameters:
this : DrawingTypes/Box object
Returns: box created from DrawingTypes/Box object
draw(this)
Creates labels from array of DrawingTypes/Label objects
Parameters:
this : Array of DrawingTypes/Label objects
Returns: Array of DrawingTypes/Label objects
createLabel(this, lblText, tooltip, properties)
Creates DrawingTypes/Label object from DrawingTypes/Point
Parameters:
this : DrawingTypes/Point object
lblText : Label text
tooltip : Tooltip text. Default is na
properties : DrawingTypes/LabelProperties object. Default is na - meaning default values are used.
Returns: DrawingTypes/Label object
createLine(this, other, properties)
Creates DrawingTypes/Line object from one DrawingTypes/Point to other
Parameters:
this : First DrawingTypes/Point object
other : Second DrawingTypes/Point object
properties : DrawingTypes/LineProperties object. Default set to na - meaning default values are used.
Returns: DrawingTypes/Line object
createLinefill(this, other, fillColor, transparency)
Creates DrawingTypes/Linefill object from DrawingTypes/Line object to other DrawingTypes/Line object
Parameters:
this : First DrawingTypes/Line object
other : Other DrawingTypes/Line object
fillColor : fill color of linefill. Default is color.blue
transparency : fill transparency for linefill. Default is 80
Returns: Array of DrawingTypes/Linefill object
createBox(this, other, properties, textProperties)
Creates DrawingTypes/Box object from one DrawingTypes/Point to other
Parameters:
this : First DrawingTypes/Point object
other : Second DrawingTypes/Point object
properties : DrawingTypes/BoxProperties object. Default set to na - meaning default values are used.
textProperties : DrawingTypes/BoxText object. Default is na - meaning no text will be drawn
Returns: DrawingTypes/Box object
createBox(this, properties, textProperties)
Creates DrawingTypes/Box object from DrawingTypes/Line as diagonal line
Parameters:
this : Diagonal DrawingTypes/PoLineint object
properties : DrawingTypes/BoxProperties object. Default set to na - meaning default values are used.
textProperties : DrawingTypes/BoxText object. Default is na - meaning no text will be drawn
Returns: DrawingTypes/Box object
DrawingTypesLibrary "DrawingTypes"
User Defined Types for basic drawing structure. Other types and methods will be built on these.
Point
Point refers to point on chart
Fields:
price : pivot price
bar : pivot bar
bartime : pivot bar time
LineProperties
Properties of line object
Fields:
xloc : X Reference - can be either xloc.bar_index or xloc.bar_time. Default is xloc.bar_index
extend : Property which sets line to extend towards either right or left or both. Valid values are extend.right, extend.left, extend.both, extend.none. Default is extend.none
color : Line color
style : Line style, valid values are line.style_solid, line.style_dashed, line.style_dotted, line.style_arrow_left, line.style_arrow_right, line.style_arrow_both. Default is line.style_solid
width : Line width. Default is 1
Line
Line object created from points
Fields:
start : Starting point of the line
end : Ending point of the line
properties : LineProperties object which defines the style of line
object : Derived line object
LabelProperties
Properties of label object
Fields:
xloc : X Reference - can be either xloc.bar_index or xloc.bar_time. Default is xloc.bar_index
yloc : Y reference - can be yloc.price, yloc.abovebar, yloc.belowbar. Default is yloc.price
color : Label fill color
style : Label style as defined in www.tradingview.com Default is label.style_none
textcolor : text color. Default is color.black
size : Label text size. Default is size.normal. Other values are size.auto, size.tiny, size.small, size.normal, size.large, size.huge
textalign : Label text alignment. Default if text.align_center. Other allowed values - text.align_right, text.align_left, text.align_top, text.align_bottom
text_font_family : The font family of the text. Default value is font.family_default. Other available option is font.family_monospace
Label
Label object
Fields:
point : Point where label is drawn
lblText : label text
tooltip : Tooltip text. Default is na
properties : LabelProperties object
object : Pine label object
Linefill
Linefill object
Fields:
line1 : First line to create linefill
line2 : Second line to create linefill
fillColor : Fill color
transparency : Fill transparency range from 0 to 100
object : linefill object created from wrapper
BoxProperties
BoxProperties object
Fields:
border_color : Box border color. Default is color.blue
bgcolor : box background color
border_width : Box border width. Default is 1
border_style : Box border style. Default is line.style_solid
extend : Extend property of box. default is extend.none
xloc : defines if drawing needs to be done based on bar index or time. default is xloc.bar_index
BoxText
Box Text properties.
Fields:
boxText : Text to be printed on the box
text_size : Text size. Default is size.auto
text_color : Box text color. Default is color.yellow.
text_halign : horizontal align style - default is text.align_center
text_valign : vertical align style - default is text.align_center
text_wrap : text wrap style - default is text.wrap_auto
text_font_family : Text font. Default is
Box
Box object
Fields:
p1 : Diagonal point one
p2 : Diagonal point two
properties : Box properties
textProperties : Box text properties
object : Box object created
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)を元にフィボナッチを計算します。
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! 🚀🚀🚀
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"…吹き出し表示
Channel Based Zigzag [HeWhoMustNotBeNamed]🎲 Concept
Zigzag is built based on the price and number of offset bars. But, in this experiment, we build zigzag based on different bands such as Bollinger Band, Keltner Channel and Donchian Channel. The process is simple:
🎯 Derive bands based on input parameters
🎯 High of a bar is considered as pivot high only if the high price is above or equal to upper band.
🎯 Similarly low of a bar is considered as pivot low only if low price is below or equal to lower band.
🎯 Adding the pivot high/low follows same logic as that of regular zigzag where pivot high is always followed by pivot low and vice versa.
🎯 If the new pivot added is of same direction as that of last pivot, then both pivots are compared with each other and only the extreme one is kept. (Highest in case of pivot high and lowest in case of pivot low)
🎯 If a bar has both pivot high and pivot low - pivot with same direction as previous pivot is added to the list first before adding the pivot with opposite direction.
🎲 Use Cases
Can be used for pattern recognition algorithms instead of standard zigzag. This will help derive patterns which are relative to bands and channels.
Example: John Bollinger explains how to manually scan double tap using Bollinger Bands in this video: www.youtube.com This modified zigzag base can be used to achieve the same using algorithmic means.
🎲 Settings
Few simple configurations which will let you select the band properties. Notice that there is no zigzag length here. All the calculations depend on the bands.
With bands display, indicator looks something like this
Note that pivots do not always represent highest/lowest prices. They represent highest/lowest price relative to bands.
As mentioned many times, application of zigzag is not for buying at lower price and selling at higher price. It is mainly used for pattern recognition either manually or via algorithms. Lets build new Harmonic, Chart patterns, Trend Lines using the new zigzag?
Moving Average Based Zig ZagMoving Average Based Zig Zag differs from the traditional Zig Zag indicator in that pivot points are determined by a moving average, Volume Weighted Hull Moving Average, rather than looking for the highest or lowest point in a left / right period.
Settings
Source: the source for the pivot points.
Moving Average Length: the length of the Volume Weighted Hull Moving Average, increase for longer zig zags, decrease for shorter zig zags.
Usage
Like all Zig Zag indicators, the Moving Average Based Zig Zag is not intended to be used as a live trading tool. This indicator is intended to be an alternative way of determining pivot points on your chart. Pivot points can be used for a multitude of different analytical techniques. One may use pivot points in order to draw potential support and resistance lines, trend lines or chart patterns. Additionally, pivot points can be used to determine variations of highs and lows important to market structure analysis such as break of structure or change of character.
Details
The moving average used is a Volume Weighted Hull Moving Average, this particular moving average was used due to it's relatively low-lag characteristics when compared to an Exponential Moving Average, additionally by considering volume in the moving average calculation, insignificant pivot points can be further filtered.
Rather than using built-in functions `ta.pivothigh()` and `ta.pivotlow()` to determine pivot points, this indicator waits for the moving average to pivot then searches for the highest or lowest value from the bar index of the moving average pivot to the bar index of the previous found price pivot. This method of determining pivots provides a more dynamic approach to determining pivot points.
Davin's 10/200MA Pullback on SPY Strategy v2.0Strategy:
Using 10 and 200 Simple moving averages, we capitalize on price pullbacks on a general uptrend to scalp 1 - 5% rebounds. 200 MA is used as a general indicator for bullish sentiment, 10 MA is used to identify pullbacks in the short term for buy entries.
An optional bonus: market crash of 20% from 52 days high is regarded as a buy the dip signal.
An optional bonus: can choose to exit on MA crossovers using 200 MA as reference MA (etc. Hard stop on 50 cross 200)
Recommended Ticker: SPY 1D (I have so far tested on SPY and other big indexes only, other stocks appear to be too volatile to use the same short period SMA parameters effectively) + AAPL 4H
How it works:
Buy condition is when:
- Price closes above 200 SMA
- Price closes below 10 SMA
- Price dumps at least 20% (additional bonus contrarian buy the dip option)
Entry is on the next opening market day the day after the buy condition candle was fulfilled.
Sell Condition is when:
- Prices closes below 10 SMA
- Hard stop at 15% drawdown from entry price (adjustable parameter)
- Hard stop at medium term and long term MA crossovers (adjustable parameters)
So far this strategy has been pretty effective for me, feel free to try it out and let me know in the comments how you found :)
Feel free to suggest new strategy ideas for discussion and indicator building
Trend/Retracement - ZigZag - New wayZigZag for Trend and Retracements - New way
It's another way to plot ZigZag based on lookback period for trend and % of trend lookback period to plot retracements.
█ OVERVIEW
Plot ZigZag, Trend lines, Retracements, Support levels, Resistance levels
█ Objective:
Draw ZigZag lines along with unbroken support and resistance levels. ZigZag lines are drawn for main trend and the retracements.
Main Trend – This is calculated based on lookback period.
Retracements – Retracements are calculated as 25% of main trend.
Support and Resistance line: The indicator draws 2 types of support and resistance lines
1. Un-broken – Once formed (plotted), these are the support and resistance which are not yet broken
2. Tested – One can also choose to see support and resistance lines which are tested but not broken. Tested support/resistance are those levels which are touched by high/low price but close price has not crossed the level.
█ How main trend point is calculated:
E.g.
Chart timeframe = 15m
Lookback period = 250
Retracement = 25% of main trend ( 25% of 250 = 62 )
A price point on a chart is considered as trend point if distance between current price and previous highest price is 250 candles
A price point is considered as a retracement if distance between current price and previous highest price is 62 candles. Please note retracements are calculated only after finding a main trend point.
█ Input parameters:
Zigzag Parameters
Use predefined Lookback – If checked pre-defined timeframe-based lookback parameters are used.
Trend lookback candles – If ‘Use predefined Lookback’ is unchecked then this value is used as lookback period.
Retracement % of look back candles– If ‘Use predefined Lookback’ is unchecked then this value is used for calculating retracement lookback period
Mark retracements – If unchecked only main trend lines are plotted
Plot support/resistance – To plot support/resistance levels
Show support/resistance tested lines – If checked tested support/resistance liens are shown on the chart
█ TF based Lookback period config (Defaults are set as specified below, One can change these defaults to use different lookback periods)
The defaults set here are used based on the chart timeframe. e.g. if chart timeframe is changed from say 15m to 60m then 60m chart defaults (i.e. trend lookback = 90) are used to plot the trend and the retracements. At the bottom-right of the chart, parameters used for plotting are displayed all the time.
Timeframe in minute – Default = 5m
Trend lookback candles – Default = 375 (~ 5 days of data)
Timeframe in minute – Default = 15m
Trend lookback candles – Default = 250 (~10 days of data)
Timeframe in minute – Default = 60m
Trend lookback candles = Default = 90 (~ 15 days of data)
Trend lookback candles for timeframe 'D' – Default = 30 (~1 month data)
Trend lookback candles for timeframe 'W' – Default = 21 (~6 months data)
Trend lookback candles for timeframe 'M' – Default = 12 (~1year data)
Retracement % of look back candles – Default = 25%
█ When and where one can use this indicator (Refer to chart examples)
To view support and resistance based on lookback period
To view ZigZag lines
One can use it to find chart patterns easily
Trend and retracement lines can help in drawing Elliott waves.
█ Chart examples:
1. Chart patterns can be easily identified - One can disable the candle charts which will help to identify and draw chart patterns easily
2. Trend and retracement lines can also help is analyzing charts (e.g. Elliott Waves can be marked based on trend lines)
3. Tested but not broken support and resistance lines can be viewed
4. You can select 'NOT' to plot tested support and resistance lines
5. Uncheck the Mark retracements to plot main trend lines (Retracements are not marked)
RSI + MA, LinReg, ZZ (HH HL LH LL), Div, Ichi, MACD and TSI HistRelative Strength Index with Moving Average, Linear Regression, Zig Zag (Highs and Lows), Divergence, Ichimoku Cloud, Moving Average Convergence Divergence and True Strength Index Histogram
This script is based on zdmre's RSI script, I revamped a lot of things and added a few indicators from ParkF's RSI script.
Disable Labels in the Style tab and the histogram if you don't enlarge the indicator and it seems too small.
Look to buy in the oversold area and bounce of the support of the linear regression.
Look to sell in the overbought area and bounce of the resistance of the linear regression.
Look for retracement to the moving average or horizontal lines, and divergences for potential reversal.
RSI
The Relative Strength Index (RSI) is a well versed momentum based oscillator which is used to measure the speed (velocity) as well as the change (magnitude) of directional price movements.
Moving Average
Moving Average (MA) is a good way to gauge momentum as well as to confirm trends, and define areas of support and resistance.
Linear Regression
The Linear Regression indicator visualizes the general price trend of a specific part of the chart based on the Linear Regression calculation.
Zig Zag (Highs and Lows)
The Zig Zag indicator is used to identify price trends, and in doing so plots points on the chart to mark whenever prices reverse by a larger percentage point than a predetermined variable or marker.
Divergence
The divergence indicator warns traders and technical analysts of changes in a price trend, oftentimes that it is weakening or changing direction.
Ichimoku Cloud
The Ichimoku Cloud is a package of multiple technical indicators that signal support, resistance, market trend, and market momentum.
MACD and TSI Histogram
MACD can be used to identify aspects of a security's overall trend.
The True Strength Index indicator is a momentum oscillator designed to detect, confirm or visualize the strength of a trend.
RSI TrendRSI Hull Trend is a hybrid indicator with RSI of HULL Signal. The Hull MA is combined with RSI to see if the Hull MA Buy/Sell Signal is in overbought or oversold condition. Buy Sell Signals are plotted based on settings of OB/OS or RSI. This indicator is very useful to see if the Trend is in Exhaustion or Beginning of a Trend. Entry and Exit conditions can be more precise based on OB/OS condition of price action. In addition normal RSI trend is plotted with trend color from Hull MA. Best Performance with Heiken Ashi Candles.
OB/OS Settings provided
Hull Buy/Sell Signals plotted
Double RSI FAST and DEFAULT signal with crossover
Bar Color applied based on Hull RSI Trend
Hull Trend + RSI + Price Action
PharshK RSI and Zigzag with H/LIt is with RSI level
and Zigzag Pattern that Market goes on Maximum level and Lower Level
And it is also Showing High and Law Level of last Moving Candle so it is easy to entry and Hold
PharshK RSI and Zigzag with H/LIt is with RSI level
and Zigzag Pattern that Market goes on Maximum level and Lower Level
And it is also Showing High and Law Level of last Moving Candle so it is easy to entry and Hold
CHS Zig ZagCHS ZigZag stands for Changeable Source ZigZag
The original ZigZag indicator offered by TradingView doesn't have the ability to measure the tips and troughs based on closing prices (line chart), however, this indicator is capable of receiving an input from user that determines the price source used for further calculations.
The default inputs of the original ZigZag indicator have been also changed in order to make it adapt to pivots formed on line chart but users can change arbitrarily.
Structured zigzag support&resistance [LM]Hello Traders,
I would like to introduce you Structured zigzag support&resistance. It is based on the ZigZag semafor script made by DevLucem so shout out to him
The indicator is used to spot future multi-level Supports and Resistance zones. It is also useful to spot HL or LL or HH or LH zones
I's the same zigzag indicator as my other zigzag indicator with highlight on diagonal lines(highs and lows are automatically classified and also new types of diagonal lines that connects low or highs and extends to right are drawn )
It has two settings:
Fist is to control horizontal lines and zigzag setting
Second is to control diagonal lines
I hope you will enjoy it as I enjoyed to write it.
Lukas