I'm trying to program an indicator that show the resistant area
the resistant area should be box ( triangle )
the main idea that the indicator detect the highest red candles with upper tale more that 50% of the candle length
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TEST
//@version=4
study("--- TEST --- ", overlay=true)
redbar = close < open
greenbar = close > open
low_tale = min(close,open) - low
upper_tale = high - max(open,close)
candle_length = high - low
hiLen = input(title="High Length", type=input.integer, defval=25)
hiHighs = highest(high, hiLen)[1]
loLen = input(title="Low Length", type=input.integer, defval=25)
loLows = lowest(low, loLen)[1]
if redbar and upper_tale > ( 0.5 * candle_length ) and high > hiHighs
label.new(bar_index, high, "Short", yloc = yloc.abovebar, color = color.red, style = label.style_arrowdown)
the demo image as shown now
this is what I wanna to do
- I wanna to show the last 4 candles with it's box as shown with the same condition , but i can increase it or decrease it as input
** of course the top of the box is the high of the target candle and the Low of the box is the low of the target candle