OPEN-SOURCE SCRIPT

Chart Pattern Strategy - Head and Shoulders / Double Top/Bottom

220
Key Chart Patterns for Trading:
Head and Shoulders (Reversal Pattern):

Head and Shoulders signals a reversal of an uptrend (bearish) when the price forms a peak (head) with two smaller peaks (shoulders) on either side.
Inverse Head and Shoulders signals a reversal of a downtrend (bullish).
Double Top / Double Bottom (Reversal Pattern):

Double Top: A bearish reversal pattern where price makes two peaks at roughly the same level, indicating resistance.
Double Bottom: A bullish reversal pattern where price forms two troughs at roughly the same level, indicating support.
Triangles (Continuation Pattern):

Symmetrical Triangle: A neutral pattern that forms when the price is consolidating. A breakout in either direction (up or down) indicates the direction of the next move.
Ascending Triangle: A bullish continuation pattern formed by a horizontal resistance and an upward-sloping support line.
Descending Triangle: A bearish continuation pattern formed by a horizontal support and a downward-sloping resistance line.
Flags and Pennants (Continuation Pattern):

Flag: A rectangular-shaped pattern that slopes against the prevailing trend.
Pennant: A small symmetrical triangle that forms after a sharp price movement (flagpole), typically signaling continuation.
Entry and Exit Logic:
Entry: A breakout of the defined pattern, either upward (bullish) or downward (bearish), can serve as the entry point.
Exit: Target price can be based on the height of the pattern (for example, the distance from the neckline in a head-and-shoulders pattern), or using Risk-to-Reward Ratio (set based on previous patterns' performance).
Example of Chart Pattern Strategy in Pine Script
Let's create a Pine Script strategy that implements chart pattern-based entries and exits. We will focus on a few common patterns: Head and Shoulders, Double Top/Bottom, and Triangles.

Pine Script Example for Chart Pattern Strategy
This example demonstrates how to code a basic strategy for identifying a head and shoulders pattern and executing trades based on its breakouts.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.