OPEN-SOURCE SCRIPT

Candlestick Pattern with Trend Confirmation

75
Below is the TradingView Pine Script code that detects various candlestick patterns based on the trend direction. The script will highlight bullish and bearish patterns on the 4-hour chart, and it will only trigger the relevant patterns if they occur in the correct trend direction.

The basic idea is:

Bullish Patterns like bullish engulfing, morning star, hammer, and piercing line are only valid in an uptrend.
Bearish Patterns like bearish engulfing, evening star, shooting star, and dark cloud cover are only valid in a downtrend.
The trend will be determined using a 50-period simple moving average (SMA).

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.