//If the Candle in index of 1 (the candle being detected as engulfing and imbalanced) and the next candle does not fill the imbalance, then a signal is generated. bullishEngulfing = openBarCurrent <= closeBarPrevious and openBarCurrent < openBarPrevious and closeBarCurrent > openBarPrevious and lowBarNext > highBarPrevious bearishEngulfing = openBarCurrent >= closeBarPrevious and openBarCurrent > openBarPrevious and closeBarCurrent < openBarPrevious and highBarNext < lowBarPrevious
//Box Variables var box[] bearboxarray = array.new_box() var box[] bullboxarray = array.new_box()
//Box Color Variables var color adbearboxcolor = color.new(bearboxcolor, adtransp) var color adbullboxcolor = color.new(bullboxcolor, adtransp) var color adbearborderboxcolor = color.new(bearboxcolor, adtransp) var color adbullborderboxcolor = color.new(bullboxcolor, adtransp)
//Bearish OB Box Calculation f_choppedoffbear(bearboxarray) => if (array.size(bearboxarray) > 0) for i = array.size(bearboxarray) - 1 to 0 cutbox = array.get(bearboxarray, i) boxlowzone = box.get_bottom(cutbox) boxhighzone = box.get_top(cutbox) boxrightzone = box.get_right(cutbox) if (na or (bar_index - 1 == boxrightzone and not ((high > boxlowzone and low < boxlowzone) or (high > boxhighzone and low < boxhighzone)))) box.set_right(array.get(bearboxarray, i), bar_index)
//Bearish OB Box Plotting if (bearishEngulfing and showOBboxes) boxhighzone = high[2] > high[1] ? high[2] : high [1] boxlowzone = open[2] bearbox = box.new(bar_index_, boxhighzone, bar_index, boxlowzone, border_color=adbearborderboxcolor, border_style=line.style_dashed, bgcolor=adbearboxcolor) if (array.size(bearboxarray) > adboxcount) box.delete(array.shift(bearboxarray)) array.push(bearboxarray, bearbox)
f_choppedoffbear(bearboxarray)
//Bullish OB Box Calculation
f_choppedoffbull(bullboxarray) => if (array.size(bullboxarray) > 0) for i = array.size(bullboxarray) - 1 to 0 cutbox = array.get(bullboxarray, i) boxlowzone = box.get_bottom(cutbox) boxhighzone = box.get_top(cutbox) boxrightzone = box.get_right(cutbox) if (na or (bar_index - 1 == boxrightzone and not ((high > boxlowzone and low < boxlowzone) or (high > boxhighzone and low < boxhighzone)))) box.set_right(array.get(bullboxarray, i), bar_index)
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.