0% found this document useful (0 votes)
1K views1 page

Pine

The document is a Pine Script code for a Chart Patterns Detector that identifies various chart patterns in trading. It includes functions to detect Head and Shoulders, Double Top, Double Bottom, Ascending Triangle, and Descending Triangle. The script plots labels on the chart to indicate the detected patterns with specific colors.

Uploaded by

jamilbassim28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views1 page

Pine

The document is a Pine Script code for a Chart Patterns Detector that identifies various chart patterns in trading. It includes functions to detect Head and Shoulders, Double Top, Double Bottom, Ascending Triangle, and Descending Triangle. The script plots labels on the chart to indicate the detected patterns with specific colors.

Uploaded by

jamilbassim28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//@version=5

indicator("Chart Patterns Detector", overlay=true)

// Function to detect Head and Shoulders


isHeadAndShoulders() =>
leftShoulder = high[5] < high[3] and high[3] > high[1] and high[3] > high[4]
head = high[3] > high[2] and high[3] > high[0]
rightShoulder = high[1] < high[3] and high[1] > high[2] and high[1] > high[4]
leftShoulder and head and rightShoulder

// Function to detect Double Top


isDoubleTop() =>
top1 = high[3] > high[1] and high[3] > high[5]
top2 = high[1] > high[0] and high[1] > high[2]
top1 and top2

// Function to detect Double Bottom


isDoubleBottom() =>
bottom1 = low[3] < low[1] and low[3] < low[5]
bottom2 = low[1] < low[0] and low[1] < low[2]
bottom1 and bottom2

// Function to detect Ascending Triangle


isAscendingTriangle() =>
low[3] < low[5] and low[1] < low[3] and high[1] == high[3]

// Function to detect Descending Triangle


isDescendingTriangle() =>
high[3] > high[5] and high[1] > high[3] and low[1] == low[3]

// Plotting patterns
if isHeadAndShoulders()
label.new(bar_index, high, "Head & Shoulders", color=color.red,
style=label.style_label_down)

if isDoubleTop()
label.new(bar_index, high, "Double Top", color=color.red,
style=label.style_label_down)

if isDoubleBottom()
label.new(bar_index, low, "Double Bottom", color=color.green,
style=label.style_label_up)

if isAscendingTriangle()
label.new(bar_index, high, "Ascending Triangle", color=color.blue,
style=label.style_label_down)

if isDescendingTriangle()
label.new(bar_index, low, "Descending Triangle", color=color.blue,
style=label.style_label_up)

You might also like