HarmonicPatternLibrary "HarmonicPattern"
Functions to detect/check harmonic patterns from provided values.
line_price_rate(point_c, point_b, point_a) Compute the price rate of the line AB divided by the the line BC
Parameters:
point_c : float, the price at point C.
point_b : float, the price at point B.
point_a : float, the price at point A.
Returns: float
line_time_rate(_c, _b, _a) Compute the time rate of the line AB divided by the the line BC
Parameters:
_c : float, the time or bar_index at point C.
_b : float, the time or bar_index at point B.
_a : float, the time or bar_index at point A.
Returns: float
is_inrange(value, min, max) Check if value is within min/max range of tolerance.
Parameters:
value : float, value to check tolerance.
min : float, minimum value in range of tolerance.
max : float, maximum value in range of tolerance.
Returns: bool
isHarmonicTriangle(rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("Harmonic Triangle").
Parameters:
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is2Tap(rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("2Tap", 'Double Top / Bottom').
Parameters:
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is3Tap(rate_edc, rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("3Tap", "Triple Top / Bottom").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is4Tap(rate_gfe, rate_edc, rate_cba, margin_of_error) Check if the rate(s) correspond to pattern ("4Tap", "Quadruple Top / Bottom").
Parameters:
rate_gfe : float, percent rate of the triangle GFE. expects a negative rate.
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isABCD(rate_cba, rate_dcb, margin_of_error) Check if the rate(s) correspond to pattern ("AB=CD").
Parameters:
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isBat(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Bat").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isButterfly(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Butterfly").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isGartley(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Gartley").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isCrab(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Crab").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isShark(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Shark").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is5o(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("5o").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isWolfe(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Wolfe").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
is3Driver(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("3 Driver").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isConTria(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Contracting Triangle").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isExpTria(rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Expanding Triangle").
Parameters:
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
isHnS(rate_fed, rate_feb, rate_edc, rate_dcb, rate_cba, rate_eda, margin_of_error) Check if the rate(s) correspond to pattern ("Head and Shoulders").
Parameters:
rate_fed : float, percent rate of the triangle FED. expects a negative rate.
rate_feb : float, percent rate of the triangle FEB. expects a negative rate.
rate_edc : float, percent rate of the triangle EDC. expects a negative rate.
rate_dcb : float, percent rate of the triangle DCB. expects a negative rate.
rate_cba : float, percent rate of the triangle CBA. expects a negative rate.
rate_eda : float, percent rate of the triangle EDA. expects a negative rate.
margin_of_error : float, percent rate of expected error margin, default 0.05(5%).
Returns: bool
Market Geometry
Function Square WaveThis is a script to draw a square wave on the chart, with an indicator for current price.
Markets undergoing Dow Jones or Wyckoff Accumulation/Distribution cycles tend to move in such waves, and if the period of the cycles are detected, a signal for accumulation/distribution phases can be created as an early warning.
Useful inputs:
- Average True Range as the wave height.
- Assumed Wave period as the wave duration.
I divided the current price wave by 2 to make the indicator more visually friendly.
GLHF
- DPT
Grid SystemThis script plots a a square composed of 8 equilateral triangles ("grid"). User can set the frequency of calculation/interval by adjusting the 't' parameter.
Steps for calculating grid:
1. Find the highest high and lowest low for last 't' periods.
2. Calculate midpoint for prices during that interval (highest high + lowest low) / 2.
3. Center of the grid = {time , price midpoint}.
Interpretation:
Volatility : If price is volatile for a given period, the area of the grid will expand, since the top and bottom sides are based on the highest high and lowest low for the period. So as range for a given period increases, the grid's area increases.
Support and resistance : The grid's center line often acts as the support / resistance line.
Trend Following : The example chart shows Cognex (CGNX) price using an interval of t=365. When the stock's trend was bullish, the area of the grids became increasingly larger and the y-coordinate of each grid was greater than that of the previous grid.
[JRL] Murrey Math LinesMurrey Math Lines are support and resistance lines based on geometric mathematical formulas developed by T.
H. Murrey. MM lines are a derivation of the observations of W.D. Gann. Murrey's geometry facilitate the use of Gann's theories in a somewhat easier application. According to Gann's theory, price tends to trend and retrace in 1/8th intervals. The most important MM line levels are the 0/8, 4/8 and 8/8 levels, which typically provide strong support and resistance points. The 3/8 and 5/8 levels represent the low and high of the typical trading range. When price is above the typical trading range, it is considered overbought, and when it is below it is considered oversold. The 2/8 and 6/8 levels provide strong pivot points.
Some of the other Murrey Math indicators on TradingView use different formulas and therefore produce varying results. I've checked my indicator against MM indicators on other platforms and it is consistent with those indicators.
This indicator also allows users to switch to alternative timeframes for analysis and it includes labels for the MM lines. If you have any suggestions or comments, please leave them below.
Cheers!
[RS]Function - Geometric Line Drawingsfunctions using the new line functions in V4 to draw multiple geometric shapes.