OPEN-SOURCE SCRIPT

Three Drive Pattern Detector [LuxAlgo]

LuxAlgo의
Wizard
The Three Drives Pattern Detector indicator focuses on detecting and displaying completed Three Drives patterns on the user chart. This harmonic pattern is characterized by successive higher highs / lower lows following specific ratios.

The script uses a multi-length swing detection approach, as well as adjusting ratios to ensure flexibility and a maximum number of visible Three Drives patterns.

🔶 USAGE

스냅샷

The bullish/bearish Three Drives pattern is commonly interpreted as a reversal pattern and is characterized by three extensions (drives) and two intermediary retracements creating consecutive higher lows (for a bullish case) or lower highs (for a bearish case).

스냅샷

The multi-length swing detection approach taken by the indicator allows for detecting shorter-term alongside medium/longer-term patterns simultaneously, allowing to increase in the amount of detected patterns.

스냅샷

Users can set a Minimum Swing length (for example 2) and a Maximum Swing length (for example 100) which defines the range of the swing point detection length, higher values for these settings will detect longer-term Three-Drives patterns, while a larger range will allow for the detection of a larger number of patterns.

스냅샷

Sometimes multiple dashed lines as the last segment can be observed. This means multiple Three Drives patterns sharing multiple swing points have formed, with only the last segment being different.

🔹 Retracement/Extension Ratios

스냅샷

The Three Drives pattern often associates the retracement/extension to Fibonacci ratios of respectively 0.618/1.272.

Some sources specify a maximum retracement/extension level of 0.786/1.618, which means the retracement should be within the 0.618-0.786 range and the extension between 1.272-1.618.

Since finding a pattern where the retracement/extension is precisely at the 0.618/1.272 levels, or even between 0.618-0.786/1.272-1.618 is rare, the script allows users to adjust those ratios, which ensures more flexibility. Depending on the widening/tightening of the ratios, allowing users to find more patterns (but potentially less valid) or more valid (but fewer patterns).

스냅샷

In the example above, "Show Ratios" is set to "Ratios With Margin", showing the ideal retracement/extension level together with the margin, while in the example below, "Show Ratios" is set to "Ratios", which shows only a line where the price should ideally reverse.

스냅샷

While setting the ratios wider will result in more frequent but less valid patterns, it can also create good trading opportunities.

스냅샷

🔹 Best Practices

The indicator doesn't include Stop Loss (SL) or Take Profit (TP) levels, however, the 1.618 Fibonacci Extension level of the last leg can commonly be used as stop loss.

Typical Take Profit areas include:

  • Starting point of the pattern
  • Each retracement level (2x)
  • The 0.618 retracement level of the complete pattern


스냅샷

In the above bullish examples, the price was lower than the lowest point of the pattern. The price reversed and attained all TP levels without hitting the SL level.

스냅샷

In the above bearish example, the price went above the highest point of the pattern but did not hit the SL level, after which two TP levels were hit. Then, the price quickly went up, just missing the SL level before it came back down again, hitting the last 2 TP levels.

스냅샷

This example shows that other Fibonacci levels an also be effective when combined with the Three Drives pattern, even in the longer term.

🔶 DETAILS

🔹 Multi Length

The core of this publication is the multi-length swing detection. To ensure the maximum amount of Three Drives patterns are found, up to 99 different swing length periods can be used to detect swing points which are then tested for valid patterns.

스냅샷

Using a wider variety of swing points also ensures that patterns visible only with specific Swing settings can be found on the same chart without the user needing to constantly adjust the Swing settings to find other patterns.

The user only needs to set the desired minimum and maximum Swing Length.

스냅샷

In this case, swing detection using swing Lengths from 3 to 100 (97 different) are computed and evaluated for patterns. Three different patterns were found on the same chart, with swing lengths 3, 4, and 6.

Note: The Maximum Swing length should be equal to or higher than the Minimum Swing Length. If the maximum value is lower than the minimum, the script will automatically take the minimum value as the maximum to prevent errors.

🔹 Width Margin %

스냅샷

Users can filter out patterns based on the duration of each extension/retracement segment. When the users want segments of the detected patterns to be of a similar duration, the width percentage should be set lower. When the focus is on detecting more patterns the width percentage can be set higher.

🔹 Retracement/Extension Settings

스냅샷

  • Show Ratios, set to Ratios, show the ideal Fibonacci retracement/extension level, while Ratios With Margin (example below) show the additional margins for retracement/extension.
  • The upper and lower limits can be visualized while hovering over the calculated ratio label.
  • The dashed line shows an older pattern, where the last leg has been updated.


스냅샷

🔹 Last Known Pattern

스냅샷

The included dashboard highlights the date of the most recently detected pattern; the text will show "None" if no pattern is found.

🔹 Calculated Bars

The "Calculated Bars" setting makes use of the recently introduced calc_bars_count parameter, making it possible to effectively reduce the number of historical bars during the computation of the script, which significantly improves the loading speed of the script.

Users wishing to see the most recent patterns can set this setting to 1000 for example, where only the most recent 1000 bars are used to find patterns. If every bar must be used for pattern detection, set "Calculated bars" at 0.

🔶 SETTINGS

  • Minimum Swing Length: Minimum length used for the swing detection.
  • Maximum Swing Length: Maximum length used for the swing detection.
  • Retracement: Range of required ratios used for testing retracements.
  • Extension: Range of required ratios used for testing extensions.
  • Width Margin: Influences the symmetry of the pattern; with a higher number allowing for less symmetry.


🔹 Style

  • Text Size: Text size of the ratio labels.
  • Show Ratios: Show the ideal ratio, upper/lower limit of ratios, or none.


🔹 Dashboard

  • Show Dashboard: Toggle dashboard which shows the date of the last found pattern.
  • Location: Location of the dashboard on the chart.
  • Size: Text size.


🔹 Calculation

  • Calculated Bars: Allows the usage of fewer bars for performance/speed improvement.
Chart patternsfibonnacciHarmonic PatternsluxalgopatternThree DrivesTrend Analysis
LuxAlgo
Wizard
Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항