Add snippets/shooting-star_doji_candle_finder_v6.pine
This commit is contained in:
39
snippets/shooting-star_doji_candle_finder_v6.pine
Normal file
39
snippets/shooting-star_doji_candle_finder_v6.pine
Normal file
@@ -0,0 +1,39 @@
|
||||
//@version=6
|
||||
indicator("Shooting Star and Doji Detector", overlay=true)
|
||||
|
||||
// Function to determine if a candle is a shooting star
|
||||
is_shooting_star(open, high, close, low) =>
|
||||
body_length = math.abs(close - open)
|
||||
upper_shadow = high - math.max(open, close)
|
||||
lower_shadow = math.min(open, close) - low
|
||||
|
||||
// Shooting star conditions:
|
||||
// 1. Small body (less than 1/3 of total candle length)
|
||||
// 2. Upper shadow at least 2x the body length
|
||||
// 3. Lower shadow is very small
|
||||
body_length <= (high - low) / 3 and upper_shadow >= body_length * 2 and lower_shadow <= body_length
|
||||
|
||||
// Function to determine if a candle is a doji
|
||||
is_doji(open, high, close, low) =>
|
||||
body_length = math.abs(close - open)
|
||||
total_range = high - low
|
||||
|
||||
// Doji conditions:
|
||||
// 1. Body is very small (less than 10% of total candle range)
|
||||
body_length <= total_range * 0.1
|
||||
|
||||
// Plot shooting star red mark
|
||||
plotchar(is_shooting_star(open, high, close, low),
|
||||
title="Shooting Star",
|
||||
char="+",
|
||||
location=location.abovebar,
|
||||
color=color.red,
|
||||
size=size.small)
|
||||
|
||||
// Plot doji green mark
|
||||
plotchar(is_doji(open, high, close, low),
|
||||
title="Doji",
|
||||
char="+",
|
||||
location=location.abovebar,
|
||||
color=color.green,
|
||||
size=size.small)
|
||||
Reference in New Issue
Block a user