i want to push a box in ArrayBox but i dont want to ahow the box on chart, if i change color to color.new(x , 100) its show the box with no color.
or if i remove the box with boz.delete(x) the calculate will fail..
please help me to push the box and no draw it
//@version=5
//This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
indicator('Super OrderBlock / FVG / BoS Tools by makuchaku & eFe', overlay=true, max_boxes_count=500, max_lines_count=500 , max_labels_count=500)
plotOB = input.bool(defval=true, title='Plot OB', group='Order Blocks')
obBullColor = input.color(defval=color.new(color.green, 90), title='Bullish OB Color', inline='Set Custom Color', group='Order Blocks')
obBearColor = input.color(defval=color.new(color.red, 90), title='Bearish OB Color', inline='Set Custom Color', group='Order Blocks')
obBoxBorder = input.string(defval=line.style_solid, title='OB Box Border Style', options=[line.style_dashed, line.style_dotted, line.style_solid], group='Order Blocks', tooltip='To disable border, set Border Width below to 0')
obBorderTransparency = input.int(defval=80, title='OB Border Box Transparency', minval=0, maxval=100, group='Order Blocks')
obMaxBoxSet = input.int(defval=10, title='Maximum OB Box Displayed', minval=1, maxval=100, group='Order Blocks', tooltip='Minimum = 1, Maximum = 100')
filterMitOB = input.bool(defval=true, title='Custom Color Mitigated OB', group='Order Blocks')
mitOBColor = input.color(defval=color.new(color.yellow, 20), title='Mitigated OB Color', group='Order Blocks', inline='Set Custom Color Mit OB', tooltip='Set Transparency to 0 to make mitigated OB disappear')
plotLabelOB = input.bool(defval=true, title='Plot OB Label', inline='OB label', group='Label Options')
obLabelColor = input.color(defval=color.gray, title='Color', inline='OB label', group='Label Options')
obLabelSize = input.string(defval=size.tiny, title="Size", options=[size.huge, size.large, size.small, size.tiny, size.auto, size.normal], inline='OB label', group='Label Options')
//Box Types
var int _ob = 1
var int _fvg = 2
var int _rjb = 3
var int _bos = 4
//Box Labels
var string _obLabel = "OB"
var string _fvgLabel = "FVG"
var string _rjbLabel = "RJB"
var string _bosLabel = "BoS"
var string _plus = "+"
var string _minus = "-"
var string _empty = ""
//Box Arrays
var box[] _bearBoxesOB = array.new_box()
var box[] _bullBoxesOB = array.new_box()
//Functions
isUp(index) =>
close[index] > open[index]
isDown(index) =>
close[index] < open[index]
isObUp(index) =>
isDown(index + 1) and isUp(index) and close[index] > high[index + 1]
isObDown(index) =>
isUp(index + 1) and isDown(index) and close[index] < low[index + 1]
isFvgUp(index) =>
(low[index] > high[index + 2])
isFvgDown(index) =>
(high[index] < low[index + 2])
//Function to Calculte Box Length
_controlBox(_boxes, _high, _low, _type) =>
var box_right1 = 0
var box_right2 = 0
var box_right3 = 0
if array.size(_boxes) > 0
for i = array.size(_boxes) - 1 to 0 by 1
_box = array.get(_boxes, i)
_boxLow = box.get_bottom(_box)
_boxHigh = box.get_top(_box)
_boxRight = box.get_right(_box)
if (_type == _ob)
if na or (bar_index == _boxRight and not((_high > _boxLow and _low < _boxLow) or (_high > _boxHigh and _low < _boxHigh)))
box.set_right(_box, bar_index + 1)
else
if _type == _ob
box.set_bgcolor(_box, mitOBColor)
box.set_border_color(_box, mitOBColor)
////////////////// Pivots ////////////////////
if isObUp(1) and plotOB
_bullboxOB = box.new(left=bar_index - 2, top=high[2], right=bar_index, bottom=math.min(low[2], low[1]), border_color=color.new(obBullColor, obBorderTransparency), border_style=obBoxBorder, border_width=1, bgcolor=obBullColor,
text=plotLabelOB ? _obLabel + _plus : _empty, text_halign=text.align_right, text_valign=text.align_bottom, text_size=obLabelSize, text_color=obLabelColor)
if array.size(_bullBoxesOB) > obMaxBoxSet
box.delete(array.shift(_bullBoxesOB))
array.push(_bullBoxesOB, _bullboxOB)
//Bearish OB Box Plotting
if isObDown(1) and plotOB
_bearboxOB = box.new(left=bar_index - 2, top=math.max(high[2], high[1]), right=bar_index, bottom=low[2], border_color=color.new(obBearColor, obBorderTransparency), border_style=obBoxBorder, border_width=1, bgcolor=obBearColor,
text=plotLabelOB ? _obLabel + _minus : _empty, text_halign=text.align_right, text_valign=text.align_bottom, text_size=obLabelSize, text_color=obLabelColor)
if array.size(_bearBoxesOB) > obMaxBoxSet
box.delete(array.shift(_bearBoxesOB))
array.push(_bearBoxesOB, _bearboxOB)
if plotOB
_controlBox(_bearBoxesOB, high, low, _ob)
_controlBox(_bullBoxesOB, high, low, _ob)
plese help me , i cant push a box and dont show it