Three Drive Pattern Detector [LuxAlgo]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.
Three Drives
Conditional Chart Pattern Signals: Part 2CCPS uses exclusive method to finalize pivot points and has more options to refine chart patterns.
Pattern List:
• Shark Bearish
• Shark Bullish
• Cypher Bearish
• Cypher Bullish
• Three Drives Bearish
• Three Drives Bullish
• 5-0 Bearish
• 5-0 Bullish
Label Tooltip: Show more information of the signal.
Volume: Random/Up/Down is determined by linear regression. Show pattern if volume trend is not required/up/down.
Percentile %: Intraday: 60 (active). Day and above: set at your preference. Range 0-100. A value of 0 means that no filter is applied and all patterns satisfy the condition. A value of 100 means that no pattern satisfies the condition.
Confirm Time: 1-3 candles.
Candle: Random/Bullish/Bearish.
Specification:
tinyurl.com
Usage:
Enter at the open of the next bar after the signal or right when the signal appears (depending on your very own evaluation of the market at that time as sometimes price could reach targets within one bar). Adding caution, a little bit of experience will be needed to recognize if price actually reacts and follows the signals generated by CCPS.
Stop-loss suggested by the signal is generated as a quick analysis. In general, you need to place the stop-loss higher or have your own deeper analysis to have it. Take profit based on your preference of risk and/or other indicators of target/support/resistance.
Other Features:
• Non-repainting: show honest signals on the realtime bar, not on historical bars.
• Compact design.
• Support alerts.
Markets: All (Not designed and developed for a specific market). Test on: forex, index, commodity.
Timeframes: All (Not designed and developed for a specific timeframe). Test on: 30m, 1D, 1W, 1M.
Remark:
• Reversal patterns do not have magic. Indeed, they belong to counter-trend strategy and technical analysis of high-probability (potential) reversal zone. In case of more powerful fundamental factors, a trend could continue and break reversal patterns.
• We have tried to integrate multiple base periods in the indicator but the execution time limitation for one indicator does not allow us to do so. As a result, users need to manually add the indicator multiple times with different base periods in order to find more patterns. Some common base periods are 5, 10, 15 and 20. In the future, if the platform lifts the limitation, we will have a version in which the indicator would automatically scan different base periods for users.
• Because compiled script code limit is 65000, the indicator is separated into different parts. Each part contains different patterns and could be considered as an independent detector.