isoPriceAction Breaker Zones
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ismailbayramce

//@version=4
study("isoPriceAction", shorttitle="isoPriceAction", overlay=true)
showBreakerZoneSup = input(title="Show Breaker Zone Support Areas", type=input.bool, defval=true)
showBreakerZoneRes = input(title="Show Breaker Zone Resistance Areas", type=input.bool, defval=true)
boxSize = input(20, minval=1, title="Breaker Zone Width")
boxType = input(title="Breaker Zone Heigh", defval="OC", options=["OC", "HL"])

breakerZoneForLong =  (close[0] > open[0]) and (close[1] > open[1]) and (close[0] > close[1]) and (close[2] < open[2]) and (close[2] > close[4]) and (close[3] > open[3]) and (close[4] > open[4]) and (close[3] > close[4])
if breakerZoneForLong and showBreakerZoneSup
    box.new(bar_index[2], boxType == "OC" ? close[2] : high[2], bar_index + boxSize, boxType == "OC" ? open[2] : low[2], bgcolor=color.new(color.blue, 70), border_color=color.blue)

breakerZoneForShort =  (close[0] < open[0]) and (close[1] < open[1]) and (close[0] < close[1]) and (close[2] > open[2]) and (close[2] < close[4]) and (close[3] < open[3]) and (close[4] < open[4] and (close[3] < close[4]))
if breakerZoneForShort and showBreakerZoneRes
    box.new(bar_index[2], boxType == "OC" ? close[2] : high[2], bar_index + boxSize, boxType == "OC" ? open[2] : low[2], bgcolor=color.new(color.red, 70), border_color=color.red)
