PINE LIBRARY
تم تحديثه BoxesLib

Library "BoxesLib"
isOverlappingBox(_boxes, _top, _bottom)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
isTooCloseBox(_boxes, _top, _bottom, zoneProximityPct)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
zoneProximityPct (float)
createBox(_boxes, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, zoneProximityPct, currentClose, isConfirmed)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
zoneProximityPct (float)
currentClose (float)
isConfirmed (bool)
manageBoxes(_boxes, _is_breakout, currentClose, isConfirmed)
Parameters:
_boxes (array<box>)
_is_breakout (bool)
currentClose (float)
isConfirmed (bool)
isOverlappingBox(_boxes, _top, _bottom)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
isTooCloseBox(_boxes, _top, _bottom, zoneProximityPct)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
zoneProximityPct (float)
createBox(_boxes, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, zoneProximityPct, currentClose, isConfirmed)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
zoneProximityPct (float)
currentClose (float)
isConfirmed (bool)
manageBoxes(_boxes, _is_breakout, currentClose, isConfirmed)
Parameters:
_boxes (array<box>)
_is_breakout (bool)
currentClose (float)
isConfirmed (bool)
ملاحظات الأخبار
v2Added Confluence label to identify strong Support and Resistance
ملاحظات الأخبار
v3Updated:
createBox(_boxes, _boxTexts, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, zoneProximityPct, currentClose, isConfirmed)
Parameters:
_boxes (array<box>)
_boxTexts (array<string>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
zoneProximityPct (float)
currentClose (float)
isConfirmed (bool)
ملاحظات الأخبار
v4Updated:
createBox(_boxes, _boxTexts, _isConfluence, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, zoneProximityPct, currentClose, isConfirmed)
Parameters:
_boxes (array<box>)
_boxTexts (array<string>)
_isConfluence (array<bool>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
zoneProximityPct (float)
currentClose (float)
isConfirmed (bool)
ملاحظات الأخبار
v5Updated:
createBox(_boxes, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, zoneProximityPct, currentClose, isConfirmed, confluenceColor)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
zoneProximityPct (float)
currentClose (float)
isConfirmed (bool)
confluenceColor (color)
ملاحظات الأخبار
v6Text color changed to Black
ملاحظات الأخبار
v7Added:
isBoxConfluent(_testBox, _allBoxes)
Parameters:
_testBox (box)
_allBoxes (array<box>)
ملاحظات الأخبار
v8Added:
getConfluenceBoxes(_boxes)
Parameters:
_boxes (array<box>)
ملاحظات الأخبار
v9What it does (for your users):
Overlap check (isOverlappingBox): blocks new boxes if they geometrically overlap existing ones.
Proximity check (isTooCloseBox): blocks near-duplicates within zoneProximityPct.
Confluence detection (isBoxConfluent / getConfluenceBoxes): a box is confluent only if another box with different bounds strictly overlaps it (self is skipped).
Creation (createBox):
If no overlap and not too close → create normal box.
If overlap or too close → recolor the existing overlapping/near boxes to the confluence color; do not add a new box.
Enforces capacity and deletes broken boxes against direction.
Maintenance (manageBoxes): keeps boxes aligned to the latest bar and removes invalidated boxes.
ملاحظات الأخبار
v10Updated:
createBox(_boxes, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, currentClose, isConfirmed, confluenceColor)
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
currentClose (float)
isConfirmed (bool)
confluenceColor (color)
Removed:
isTooCloseBox(_boxes, _top, _bottom, zoneProximityPct)
ملاحظات الأخبار
v11Removed:
isOverlappingBox(_boxes, _top, _bottom)
isBoxConfluent(_testBox, _allBoxes)
getConfluenceBoxes(_boxes)
ملاحظات الأخبار
v12ملاحظات الأخبار
v13Added:
manageBoxesWithBreakRetest(_boxes, _top, _bottom, _isResistance, currentClose, resistanceBreachUp, resistanceBreachDown, supportBreachDown, supportBreachUp, resistanceRetestCrossback, supportRetestCrossback, maxRetestBars, maxConfirmationBars)
Parameters:
_boxes (array<BoxState>): Array of BoxState objects
_top (float): Top level of box
_bottom (float): Bottom level of box
_isResistance (bool): True if box is resistance (false if support)
currentClose (float): Current closing price - used to validate decisive breaks
resistanceBreachUp (bool): Crossover signal for resistance (ta.crossover called on every bar globally)
resistanceBreachDown (bool): Crossunder signal for resistance (ta.crossunder called on every bar globally)
supportBreachDown (bool): Crossunder signal for support (ta.crossunder called on every bar globally)
supportBreachUp (bool): Crossover signal for support (ta.crossover called on every bar globally)
resistanceRetestCrossback (bool): Crossunder signal when price returns to resistance
supportRetestCrossback (bool): Crossover signal when price returns to support
maxRetestBars (int): Maximum bars to detect retest (like input_retValid) - limits retest window
maxConfirmationBars (int): Bars required to confirm a breach (default 2)
countActiveBreakovers(_boxes)
Parameters:
_boxes (array<BoxState>)
countRetested(_boxes)
Parameters:
_boxes (array<BoxState>)
getMostRecentBreakout(_boxes)
Parameters:
_boxes (array<BoxState>)
BoxState
BoxState Tracks the state of a box through its lifecycle
Fields:
boxObj (series box)
isBreakout (series bool): Whether this box represents a breakout (true) or retest (false)
barsBreached (series int): Number of bars since breach occurred
hasRetested (series bool): Whether price has retested this level after breach
breachDirection (series int): Direction of breach: 1 (up), -1 (down), 0 (none)
ملاحظات الأخبار
v14Added:
manageBoxesWithLabels(_boxes, _top, _bottom, _isResistance, currentClose, resistanceBreachUp, resistanceBreachDown, supportBreachDown, supportBreachUp, resistanceRetestCrossback, supportRetestCrossback, maxRetestBars, maxConfirmationBars, showBreachLabel, showRetestLabel, breachLabelColor, retestLabelColor)
Parameters:
_boxes (array<BoxState>): Array of BoxState objects to track
_top (float): Top level of support/resistance
_bottom (float): Bottom level of support/resistance
_isResistance (bool): True for resistance, false for support
currentClose (float): Current close price - validates decisive breaks
resistanceBreachUp (bool): Crossover signal for resistance breakthrough
resistanceBreachDown (bool): Crossunder signal for resistance invalidation
supportBreachDown (bool): Crossunder signal for support breakthrough
supportBreachUp (bool): Crossover signal for support invalidation
resistanceRetestCrossback (bool): Retest signal for resistance
supportRetestCrossback (bool): Retest signal for support
maxRetestBars (int): Maximum bars to detect retest - controls retest window
maxConfirmationBars (int): Bars required to confirm breach - validates break duration
showBreachLabel (bool): Whether to display "Breakout" labels
showRetestLabel (bool): Whether to display "Retest" labels - determines label visibility
breachLabelColor (color): Color for breakout labels
retestLabelColor (color): Color for retest labels and retest box coloring - applies to both label and box
Updated:
BoxState
BoxState Tracks the state of a box through its lifecycle
Fields:
boxObj (series box)
isBreakout (series bool)
barsBreached (series int)
hasRetested (series bool)
breachDirection (series int)
breachLabel (series label)
retestLabel (series label)
retestColor (series color)
Removed:
manageBoxesWithBreakRetest(_boxes, _top, _bottom, _isResistance, currentClose, resistanceBreachUp, resistanceBreachDown, supportBreachDown, supportBreachUp, resistanceRetestCrossback, supportRetestCrossback, maxRetestBars, maxConfirmationBars)
ملاحظات الأخبار
v15Added:
countActiveBoxes(_boxes)
Parameters:
_boxes (array<box>)
Updated:
BoxState
BoxState Tracks the state of a box through its lifecycle
Fields:
boxObj (series box)
isBreakout (series bool)
barsBreached (series int)
hasRetested (series bool)
breachDirection (series int)
Removed:
manageBoxesWithLabels(_boxes, _top, _bottom, _isResistance, currentClose, resistanceBreachUp, resistanceBreachDown, supportBreachDown, supportBreachUp, resistanceRetestCrossback, supportRetestCrossback, maxRetestBars, maxConfirmationBars, showBreachLabel, showRetestLabel, breachLabelColor, retestLabelColor)
countActiveBreakovers(_boxes)
countRetested(_boxes)
getMostRecentBreakout(_boxes)
ملاحظات الأخبار
v16Updated:
createBox(_boxes, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, currentClose, isConfirmed, confluenceColor)
Create box with overlap/confluence detection and capacity control.
On overlap: existing box recolored + marked, new box NOT created.
Parameters:
_boxes (array<box>): Array of managed boxes
_top (float): Box top price
_bottom (float): Box bottom price
_leftBarIndex (int): Left bar index
_color (color): Box color
_txt (string): Box tooltip text
_is_breakout (bool): True for support (breakout), false for resistance (breakdown)
numberLimit (int): Max boxes to keep
currentClose (float): Current close price for invalidation
isConfirmed (bool): Only act on confirmed bars
confluenceColor (color): Color for overlapping (confluence) boxes
Returns: box ID if created, na if overlap detected
manageBoxes(_boxes, _is_breakout, currentClose, isConfirmed)
Keep boxes right-aligned to current bar, remove when broken
Parameters:
_boxes (array<box>): Array of managed boxes
_is_breakout (bool): True for support, false for resistance
currentClose (float): Current close price
isConfirmed (bool): Only remove on confirmed bars
Removed:
countActiveBoxes(_boxes)
BoxState
BoxState Tracks the state of a box through its lifecycle
ملاحظات الأخبار
v17Updated:
createBox(_boxes, _top, _bottom, _leftBarIndex, _color, _txt, _is_breakout, numberLimit, currentClose, isConfirmed, confluenceColor)
Create box with overlap/confluence detection and capacity control
Parameters:
_boxes (array<box>)
_top (float)
_bottom (float)
_leftBarIndex (int)
_color (color)
_txt (string)
_is_breakout (bool)
numberLimit (int)
currentClose (float)
isConfirmed (bool)
confluenceColor (color)
manageBoxes(_boxes, _is_breakout, currentClose, isConfirmed)
Keep boxes right-aligned to current bar, remove when broken
Parameters:
_boxes (array<box>)
_is_breakout (bool)
currentClose (float)
isConfirmed (bool)
ملاحظات الأخبار
v18Updated:
createBox(_boxes, _top, _bot, _left, _col, _txt, _isBo, _cap, _close, _conf, _confCol)
Parameters:
_boxes (array<box>)
_top (float)
_bot (float)
_left (int)
_col (color)
_txt (string)
_isBo (bool)
_cap (int)
_close (float)
_conf (bool)
_confCol (color)
manageBoxes(_boxes, _isBo, _close, _conf)
Parameters:
_boxes (array<box>)
_isBo (bool)
_close (float)
_conf (bool)
ملاحظات الأخبار
v19Updated:
createBox(_boxes, _top, _bot, _left, _bgCol, _borderCol, _txtCol, _strongBgCol, _strongBorderCol, _txt, _cap, _isBo, _conf, _close)
Parameters:
_boxes (array<box>)
_top (float)
_bot (float)
_left (int)
_bgCol (color)
_borderCol (color)
_txtCol (color)
_strongBgCol (color)
_strongBorderCol (color)
_txt (string)
_cap (int)
_isBo (bool)
_conf (bool)
_close (float)
manageBoxes(_boxes, _isBo, _close, _conf, _extendRight)
Parameters:
_boxes (array<box>)
_isBo (bool)
_close (float)
_conf (bool)
_extendRight (bool)
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
Sreenureddy
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
Sreenureddy
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.