OPEN-SOURCE SCRIPT

Pattern Probability with EMA Filter

Aktualisiert
The provided code is a custom indicator that identifies specific price patterns on a chart and uses a 14-period Exponential Moving Average (EMA) as a filter to display only certain patterns based on the EMA trend direction. These code identifies patterns display them as upward and downward arrows indicates potential price corrections and short term trend reversals in the direction of the arrow. Use with indicators such as RSI that inform overbought and oversold condition to add reliability and confluence.
Code Explanation:
The code first calculates three values 'a', 'b', and 'c' based on the difference between the current high, low, and close prices, respectively, and their respective previous moving average values.

Binary values are then assigned to 'a', 'b', and 'c', where each value is set to 1 if it's greater than 0, and 0 otherwise.

The 'pattern_type' is determined based on the binary values of 'a', 'b', and 'c', combining them into a single number (ranging from 0 to 7) to represent different price patterns.

The code calculates a 14-period Exponential Moving Average (EMA) of the closing price.

It determines the EMA trend direction by comparing the current EMA value with the previous EMA value, setting 'ema_going_up' to true if the EMA is going up and 'ema_going_down' to true if the EMA is going down.

The indicator then plots arrows on the chart for specific pattern_type values while considering the EMA trend direction as a filter. It displays different colored arrows for each pattern_type.

The 14-period EMA is also plotted on the chart, with the color changing to green when the EMA is going up and red when the EMA is going down.

Concept:
pattern_type = 0: H- L- C- (Downward trend continuation) - Indicates a continuation of the downward trend, suggesting further losses ahead.

pattern_type = 1: H- L- C+ (Likely trend change: Downwards to upwards) - Implies the upward trend or price movement change.

pattern_type = 2: H- L+ C- (Likely trend change: Upwards to downwards) - Suggests a potential reversal from an uptrend to a downtrend, but further confirmation is needed.

pattern_type = 3: H- L+ C+ (Trend uncertainty: Potential reversal) - Indicates uncertainty in the trend, potential for a reversal, but further price action confirmation is required.

pattern_type = 4: H+ L- C- (Downward trend continuation with lower volatility) - Suggests the downward trend may continue, but with reduced price swings or lower volatility.

pattern_type = 5: H+ L- C+ (Likely trend change: Downwards to upwards) - Implies a potential reversal from a downtrend to an uptrend, with buying interest increasing.

(pattern_type = 6: H+ L+ C- (Likely trend change: Upwards to downwards) - Suggests a potential reversal from an uptrend to a downtrend, with selling pressure increasing.

pattern_type = 7: H+ L+ C+ (Upward trend continuation) - Indicates a continuation of the upward trend, suggesting further gains ahead.

In the US market, when analyzing a 15-minute chart, we observe the following proportions of the different pattern_type occurrences: The code will plot the low frequency patterns (P1 - P6)
P0 (H- L- C-): 37.60%
P1 (H- L- C+): 3.60%
P2 (H- L+ C-): 3.10%
P3 (H- L+ C+): 3.40%
P4 (H+ L- C-): 2.90%
P5 (H+ L- C+): 2.70%
P6 (H+ L+ C-): 3.50%
P7 (H+ L+ C+): 43.50%
When analyzing higher time frames, such as daily or weekly charts, the occurrence of these patterns is expected to be even lower, but they may carry more significant implications due to their rarity and potential impact on longer-term trends.
Versionshinweise
The revision adds options to choose between VWMA, EMA, SMA, and HMA moving averages and select the price (close or HLC3) for the trend line. The code calculates the selected moving average and its trend direction. The rest of the code remains the same. When input length of and MA lengths are increased it provided less false signals.
Versionshinweise
The revision introduces a dynamic threshold filter, based on the HLC3 200 SMA multiplied by 0.001, for pattern identification. one can choose between dynamic thresholds, adapting to market conditions, or a default zero value, ensuring stability. The threshold serves as a filter, determining if price movements are significant for classifying patterns. When the difference between current and previous prices (high, low, or close) exceeds the threshold, the pattern is marked with a value of 1; otherwise, it's assigned 0. This customizable feature empowers traders to fine-tune the indicator's responsiveness, improving pattern identification accuracy and providing insights into potential market trends.
Versionshinweise
The code revision incorporates a volume filter (VF) into an existing indicator. VF compares the current candle's volume to a defined average volume, filtering out patterns if VF is below a set threshold. This enhances pattern confirmation by considering market participation. Patterns meeting VF criteria are assigned binary values based on price movements. The indicator plots colored arrows on the chart for filtered pattern types, aiding traders in identifying potential trend changes. VF integration offers a dynamic way to validate patterns, contributing to more informed trading decisions.
Versionshinweise
corrected VF syntax to apply correctly and display.
Versionshinweise
Updated to have the option to apply or not apply volume filter.
Chart patterns

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss