// Параметры lookback = input.int(10, title="Период для поиска свечей", minval=1) body_threshold = input.float(0.5, title="Минимальный размер тела свечи (%)", minval=0, maxval=1)
// Функции для поиска бычьих и медвежьих ордер-блоков isBullishOrderBlock(high, low, close, open) => close > open and ((close - open) / (high - low)) >= body_threshold
isBearishOrderBlock(high, low, close, open) => close < open and ((open - close) / (high - low)) >= body_threshold
// Логика для нахождения последних ордер-блоков var float bullish_order_block = na var float bearish_order_block = na
if isBullishOrderBlock(high[1], low[1], close[1], open[1]) bullish_order_block := low[1]
if isBearishOrderBlock(high[1], low[1], close[1], open[1]) bearish_order_block := high[1]
// Рисование зон if bullish_order_block != na box.new(x1=bar_index[1], y1=bullish_order_block, x2=bar_index, y2=close, bgcolor=color.new(color.green, 85), border_color=color.green)
if bearish_order_block != na box.new(x1=bar_index[1], y1=bearish_order_block, x2=bar_index, y2=close, bgcolor=color.new(color.red, 85), border_color=color.red)
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.