Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Doji detector", overlay=true)
- ema_input = input(20, title="Ema")
- prev_p_1 = ta.ema(close, ema_input)
- lowhigh_long_prop = input(10, title="Low / High proportion")
- body_prop_size = input(9, title="Body proportion size")
- bar_size_h = high - close
- //body size
- bar_size_l = math.max(open, close) - math.min(close, open)
- //size of whole with wicks
- body_size_h = high - low
- //lowest wick size
- low_body_prop = close - low
- //higher wick size
- high_body_prop = high - close
- plot(prev_p_1)
- body_size_proportion = input(2, title="Body size (X) times smaller than whole body")
- up_wick_size_proportion = input(2, title="Upper wick size (X) times bigger than body")
- down_wick_size_proportion = input(2, title="Lower wick size (X) times bigger than body")
- is_doji_body = if body_size_h / body_size_proportion > bar_size_l
- true
- low_half_eq = if low_body_prop > bar_size_l * up_wick_size_proportion
- true
- high_half_eq = if high_body_prop > bar_size_l * down_wick_size_proportion
- true
- open_close_eq = if bar_size_l < body_size_h / body_prop_size
- true
- doji_star_up = if close <= prev_p_1 and open_close_eq and high_body_prop and low_half_eq and is_doji_body
- alert(message='Doji grave')
- true
- doji_star_down = if close > prev_p_1 and open_close_eq and high_body_prop and low_half_eq and is_doji_body
- alert(message='Doji down')
- true
- plotshape(doji_star_up, style=shape.arrowup, color=color.green, location=location.belowbar, size=size.large, text="Doji star")
- plotshape(doji_star_down, style=shape.arrowdown, color=color.red, location=location.abovebar, size=size.large, text="Doji star")
- long_high_body = if high_body_prop > bar_size_l * lowhigh_long_prop
- true
- open_low_eq = if (close - low) < body_size_h / body_prop_size
- true
- doji_grave = if close > prev_p_1 and open_close_eq and open_low_eq and long_high_body
- alert(message='Doji grave')
- true
- plotshape(doji_grave, style=shape.arrowdown, color=color.red, location=location.abovebar, size=size.large, text="Doji grave")
- long_low_body = if low_body_prop > bar_size_l * lowhigh_long_prop
- true
- open_high_eq = if (high - close) < body_size_h / body_prop_size
- true
- doji_dragonfly = if close <= prev_p_1 and open_close_eq and open_high_eq and long_low_body
- alert(message='Doji dragonfly')
- true
- plotshape(doji_dragonfly, style=shape.arrowup, color=color.green, location=location.belowbar, size=size.large, text="Doji dragonfly")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement