Dynamic Volumetric Order Blocks

NeuraAlgo · study · 435 行 · 点赞 165 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © NeuraAlgo
 
//@version=6
indicator("Dynamic Volumetric Order Blocks", overlay = true, max_bars_back = 5000, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500)
 
//────────────────────────────────────────────────────
// 01. INPUT GROUPS
//────────────────────────────────────────────────────
 
const string orderBlockDisplayGroup = "01. Order Block Display"
const string detectionSettingsGroup = "02. Detection & Mitigation"
const string activityMetricsGroup = "03. Activity Metrics"
const string barColorStrengthGroup = "04. Strength-Based Bar Colors"
const string alertConditionsGroup = "05. Alert Conditions"
 
const string constructionModeTooltip = "[Length] ATR-based order-block construction\n[Full] Use the full candle range"
const string mitigationMethodTooltip = "Select how an order block is considered mitigated."
const string metricTextSizeTooltip = "Controls the size of the volume metric text."
 
//────────────────────────────────────────────────────
// 02. ORDER BLOCK DISPLAY
//────────────────────────────────────────────────────
 
showOrderBlocks = input.bool(true, "Display Order Blocks", group = orderBlockDisplayGroup)
maxDisplayedOrderBlocks = input.int(6, "Maximum Visible Order Blocks", minval = 0, maxval = 50, group = orderBlockDisplayGroup)
showMidline = input.bool(true, "Show Midpoint Line", group = orderBlockDisplayGroup)
 
//────────────────────────────────────────────────────
// 03. DETECTION & MITIGATION
//────────────────────────────────────────────────────
 
orderBlockConstructionMode = input.string("Length", "Construction Mode", options = ["Length", "Full"], tooltip = constructionModeTooltip, group = detectionSettingsGroup)
pivotLookbackLength = input.int(20, "Pivot Lookback Length", minval = 1, maxval = 20, group = detectionSettingsGroup)
mitigationMethod = input.string("Close", "Mitigation Method", options = ["Close", "Wick", "Avg"], tooltip = mitigationMethodTooltip, group = detectionSettingsGroup)
hideOverlappingBlocks = input.bool(true, "Hide Overlapping Blocks", tooltip = "Preserve the newest overlapping order block.", group = detectionSettingsGroup)
 
//────────────────────────────────────────────────────
// 04. ACTIVITY METRICS
//────────────────────────────────────────────────────
 
showBuySellActivity = input.bool(true, "Display Buy/Sell Activity", group = activityMetricsGroup)
showVolumeMetrics = input.bool(true, "Show Volume Metrics", group = activityMetricsGroup)
metricTextSize = input.string("Normal", "Volume Metric Text Size", options = ["Tiny", "Small", "Normal", "Large", "Huge"], tooltip = metricTextSizeTooltip, group = activityMetricsGroup)
 
//────────────────────────────────────────────────────
// 05. STRENGTH-BASED BAR COLORS
//────────────────────────────────────────────────────
 
baseBullishColor = input.color(#089981, "Bullish Color", group = barColorStrengthGroup)
baseBearishColor = input.color(#f23645, "Bearish Color", group = barColorStrengthGroup)
strengthLookbackLength = input.int(100, "Volume Strength Lookback", minval = 10, group = barColorStrengthGroup)
 
bullishActivityColor = baseBullishColor
bearishActivityColor = baseBearishColor
 
color bullishBaseColor = bullishActivityColor
color bearishBaseColor = bearishActivityColor
 
//────────────────────────────────────────────────────
// 07. ORDER BLOCK ARRAYS
//────────────────────────────────────────────────────
 
var float[] orderBlockTops = array.new<float>()
var float[] orderBlockBottoms = array.new<float>()
var float[] orderBlockMidpoints = array.new<float>()
var int[] orderBlockStartTimes = array.new<int>()
var float[] orderBlockVolumes = array.new<float>()
var color[] orderBlockColors = array.new<color>()
var int[] orderBlockDirections = array.new<int>()
 
var int[] activitySequenceStates = array.new<int>()
var int[] bullishActivityCounts = array.new<int>()
var int[] bearishActivityCounts = array.new<int>()
var int[] bullishActivityEndTimes = array.new<int>()
var int[] bearishActivityEndTimes = array.new<int>()
 
var box[] renderedOrderBlockBoxes = array.new<box>()
var line[] renderedMidpointLines = array.new<line>()
var label[] renderedVolumeLabels = array.new<label>()
 
//────────────────────────────────────────────────────
// 08. HELPER FUNCTIONS
//────────────────────────────────────────────────────
 
getMetricTextSize(string sizeOption) =>
    switch sizeOption
        "Tiny" => size.tiny
        "Small" => size.small
        "Normal" => size.normal
        "Large" => size.large
        "Huge" => size.huge
 
removeOrderBlock(int orderBlockIndex) =>
    array.remove(orderBlockTops, orderBlockIndex)
    array.remove(orderBlockBottoms, orderBlockIndex)
    array.remove(orderBlockMidpoints, orderBlockIndex)
    array.remove(orderBlockStartTimes, orderBlockIndex)
    array.remove(orderBlockVolumes, orderBlockIndex)
    array.remove(orderBlockColors, orderBlockIndex)
    array.remove(orderBlockDirections, orderBlockIndex)
    array.remove(activitySequenceStates, orderBlockIndex)
    array.remove(bullishActivityCounts, orderBlockIndex)
    array.remove(bearishActivityCounts, orderBlockIndex)
    array.remove(bullishActivityEndTimes, orderBlockIndex)
    array.remove(bearishActivityEndTimes, orderBlockIndex)
 
//────────────────────────────────────────────────────
// 09. PER-BAR EVENT FLAGS
//────────────────────────────────────────────────────
 
bool bullishOrderBlockCreated = false
bool bearishOrderBlockCreated = false
bool bullishOrderBlockMitigated = false
bool bearishOrderBlockMitigated = false
bool priceEnteredBullishOrderBlock = false
bool priceEnteredBearishOrderBlock = false
 
//────────────────────────────────────────────────────
// 10. ORDER BLOCK DETECTION
//────────────────────────────────────────────────────
 
float lookbackHighestPrice = ta.highest(pivotLookbackLength)
float lookbackLowestPrice = ta.lowest(pivotLookbackLength)
float volumePivot = ta.pivothigh(volume, pivotLookbackLength, pivotLookbackLength)
float averageTrueRange = ta.atr(pivotLookbackLength)
 
var int marketStructureDirection = 0
 
marketStructureDirection := high[pivotLookbackLength] > lookbackHighestPrice ? -1 : low[pivotLookbackLength] < lookbackLowestPrice ? 1 : marketStructureDirection[1]
 
float bullishZoneBottom = orderBlockConstructionMode == "Length" ? ((high[pivotLookbackLength] - averageTrueRange[pivotLookbackLength]) < low[pivotLookbackLength] ? low[pivotLookbackLength] : high[pivotLookbackLength] - averageTrueRange[pivotLookbackLength]) : low[pivotLookbackLength]
 
float bullishZoneTop = orderBlockConstructionMode == "Length" ? ((low[pivotLookbackLength] + averageTrueRange[pivotLookbackLength]) > high[pivotLookbackLength] ? high[pivotLookbackLength] : low[pivotLookbackLength] + averageTrueRange[pivotLookbackLength]) : high[pivotLookbackLength]
 
float bearishZoneTop = high[pivotLookbackLength]
 
float bearishZoneBottom = orderBlockConstructionMode == "Length" ? ((high[pivotLookbackLength] - averageTrueRange[pivotLookbackLength]) < low[pivotLookbackLength] ? low[pivotLookbackLength] : high[pivotLookbackLength] - averageTrueRange[pivotLookbackLength]) : low[pivotLookbackLength]
 
//────────────────────────────────────────────────────
// 11. CREATE BULLISH ORDER BLOCK
//────────────────────────────────────────────────────
 
if not na(volumePivot) and marketStructureDirection == 1
    array.unshift(orderBlockTops, bullishZoneTop)
    array.unshift(orderBlockBottoms, low[pivotLookbackLength])
    array.unshift(orderBlockMidpoints, math.avg(bullishZoneTop, low[pivotLookbackLength]))
    array.unshift(orderBlockStartTimes, time[pivotLookbackLength])
    array.unshift(orderBlockVolumes, volume[pivotLookbackLength])
    array.unshift(orderBlockColors, color.new(bullishBaseColor, 90))
    array.unshift(orderBlockDirections, 1)
    array.unshift(activitySequenceStates, 1)
    array.unshift(bullishActivityCounts, 0)
    array.unshift(bearishActivityCounts, 0)
    array.unshift(bullishActivityEndTimes, time[pivotLookbackLength])
    array.unshift(bearishActivityEndTimes, time[pivotLookbackLength])
    bullishOrderBlockCreated := true
 
//────────────────────────────────────────────────────
// 12. CREATE BEARISH ORDER BLOCK
//────────────────────────────────────────────────────
 
if not na(volumePivot) and marketStructureDirection == -1
    array.unshift(orderBlockTops, high[pivotLookbackLength])
    array.unshift(orderBlockBottoms, bearishZoneBottom)
    array.unshift(orderBlockMidpoints, math.avg(high[pivotLookbackLength], bearishZoneBottom))
    array.unshift(orderBlockStartTimes, time[pivotLookbackLength])
    array.unshift(orderBlockVolumes, volume[pivotLookbackLength])
    array.unshift(orderBlockColors, color.new(bearishBaseColor, 90))
    array.unshift(orderBlockDirections, -1)
    array.unshift(activitySequenceStates, 1)
    array.unshift(bullishActivityCounts, 0)
    array.unshift(bearishActivityCounts, 0)
    array.unshift(bullishActivityEndTimes, time[pivotLookbackLength])
    array.unshift(bearishActivityEndTimes, time[pivotLookbackLength])
    bearishOrderBlockCreated := true
 
//────────────────────────────────────────────────────
// 13. MITIGATION PROCESSING
//────────────────────────────────────────────────────
 
if array.size(orderBlockTops) > 0 and barstate.isconfirmed
    for orderBlockIndex = array.size(orderBlockTops) - 1 to 0
        int currentBlockDirection = array.get(orderBlockDirections, orderBlockIndex)
        float currentBlockTop = array.get(orderBlockTops, orderBlockIndex)
        float currentBlockBottom = array.get(orderBlockBottoms, orderBlockIndex)
        float currentBlockMidpoint = array.get(orderBlockMidpoints, orderBlockIndex)
        bool isCurrentBlockMitigated = false
 
        if currentBlockDirection == 1
            if mitigationMethod == "Close"
                isCurrentBlockMitigated := math.min(close, open) < currentBlockBottom
            else if mitigationMethod == "Wick"
                isCurrentBlockMitigated := low < currentBlockBottom
            else
                isCurrentBlockMitigated := low < currentBlockMidpoint
 
            if isCurrentBlockMitigated
                bullishOrderBlockMitigated := true
                removeOrderBlock(orderBlockIndex)
        else
            if mitigationMethod == "Close"
                isCurrentBlockMitigated := math.max(close, open) > currentBlockTop
            else if mitigationMethod == "Wick"
                isCurrentBlockMitigated := high > currentBlockTop
            else
                isCurrentBlockMitigated := high > currentBlockMidpoint
 
            if isCurrentBlockMitigated
                bearishOrderBlockMitigated := true
                removeOrderBlock(orderBlockIndex)
 
//────────────────────────────────────────────────────
// 14. BUY/SELL ACTIVITY METRICS
//────────────────────────────────────────────────────
 
if array.size(orderBlockTops) > 0
    for orderBlockIndex = 0 to array.size(orderBlockTops) - 1
        int currentBlockDirection = array.get(orderBlockDirections, orderBlockIndex)
        int activitySequenceState = array.get(activitySequenceStates, orderBlockIndex)
        int bullishActivityCount = array.get(bullishActivityCounts, orderBlockIndex)
        int bearishActivityCount = array.get(bearishActivityCounts, orderBlockIndex)
 
        if currentBlockDirection == 1
            if activitySequenceState == 1
                bullishActivityCount += 1
                activitySequenceState := 2
            else if activitySequenceState == 2
                bullishActivityCount += 1
                activitySequenceState := 3
            else
                bearishActivityCount += 1
                activitySequenceState := 1
        else
            if activitySequenceState == 1
                bearishActivityCount += 1
                activitySequenceState := 2
            else if activitySequenceState == 2
                bearishActivityCount += 1
                activitySequenceState := 3
            else
                bullishActivityCount += 1
                activitySequenceState := 1
 
        array.set(bullishActivityCounts, orderBlockIndex, bullishActivityCount)
        array.set(bearishActivityCounts, orderBlockIndex, bearishActivityCount)
        array.set(activitySequenceStates, orderBlockIndex, activitySequenceState)
 
        if not na(time[2]) and (time - time[1]) == (time[1] - time[2])
            int currentBlockStartTime = array.get(orderBlockStartTimes, orderBlockIndex)
            array.set(bullishActivityEndTimes, orderBlockIndex, currentBlockStartTime + (time - time[1]) * bullishActivityCount)
            array.set(bearishActivityEndTimes, orderBlockIndex, currentBlockStartTime + (time - time[1]) * bearishActivityCount)
 
//────────────────────────────────────────────────────
// 15. OVERLAP FILTER
//────────────────────────────────────────────────────
 
if hideOverlappingBlocks and array.size(orderBlockTops) > 1
    for orderBlockIndex = array.size(orderBlockTops) - 1 to 1
        float olderBlockTop = array.get(orderBlockTops, orderBlockIndex)
        float olderBlockBottom = array.get(orderBlockBottoms, orderBlockIndex)
        float newestBlockTop = array.get(orderBlockTops, 0)
        float newestBlockBottom = array.get(orderBlockBottoms, 0)
 
        bool overlapsNewestBlock = (olderBlockBottom > newestBlockBottom and olderBlockBottom < newestBlockTop) or (olderBlockTop < newestBlockTop and olderBlockBottom > newestBlockBottom) or (olderBlockTop > newestBlockTop and olderBlockBottom < newestBlockBottom) or (olderBlockTop < newestBlockTop and olderBlockTop > newestBlockBottom)
 
        if overlapsNewestBlock
            removeOrderBlock(orderBlockIndex)
 
//────────────────────────────────────────────────────
// 16. PRICE-ENTRY ALERT DETECTION
//────────────────────────────────────────────────────
 
var bool bullishZoneEntryAlertTriggered = false
var bool bearishZoneEntryAlertTriggered = false
 
if bullishOrderBlockCreated
    bullishZoneEntryAlertTriggered := false
 
if bearishOrderBlockCreated
    bearishZoneEntryAlertTriggered := false
 
if barstate.isconfirmed and array.size(orderBlockTops) > 0
    for orderBlockIndex = 0 to array.size(orderBlockTops) - 1
        int currentBlockDirection = array.get(orderBlockDirections, orderBlockIndex)
        float currentBlockTop = array.get(orderBlockTops, orderBlockIndex)
        float currentBlockBottom = array.get(orderBlockBottoms, orderBlockIndex)
 
        if currentBlockDirection == 1 and not bullishZoneEntryAlertTriggered and low < currentBlockTop and high > currentBlockBottom
            priceEnteredBullishOrderBlock := true
            bullishZoneEntryAlertTriggered := true
 
        if currentBlockDirection == -1 and not bearishZoneEntryAlertTriggered and high > currentBlockBottom and low < currentBlockTop
            priceEnteredBearishOrderBlock := true
            bearishZoneEntryAlertTriggered := true
 
//────────────────────────────────────────────────────
// 17. DYNAMIC BUY/SELL STRENGTH
//────────────────────────────────────────────────────
 
float currentCandleRange = math.max(high - low, syminfo.mintick)
float bullishVolumePressure = volume * math.max(close - low, 0.0) / currentCandleRange
float bearishVolumePressure = volume * math.max(high - close, 0.0) / currentCandleRange
 
float averageBullishVolumePressure = ta.ema(bullishVolumePressure, strengthLookbackLength)
float averageBearishVolumePressure = ta.ema(bearishVolumePressure, strengthLookbackLength)
float totalVolumePressure = averageBullishVolumePressure + averageBearishVolumePressure
 
float bullishPressureStrength = totalVolumePressure > 0 ? averageBullishVolumePressure / totalVolumePressure * 100.0 : 0.0
float bearishPressureStrength = 100.0 - bullishPressureStrength
 
bullishPressureStrength := math.max(0.0, math.min(100.0, bullishPressureStrength))
bearishPressureStrength := math.max(0.0, math.min(100.0, bearishPressureStrength))
 
float currentCandleBullishStrength = volume > 0 ? bullishVolumePressure / volume * 100.0 : 0.0
float currentCandleBearishStrength = 100.0 - currentCandleBullishStrength
 
//────────────────────────────────────────────────────
// 18. ORDER BLOCK DRAWING
//────────────────────────────────────────────────────
 
if barstate.islast
    if array.size(renderedOrderBlockBoxes) > 0
        for orderBlockIndex = 0 to array.size(renderedOrderBlockBoxes) - 1
            box.delete(array.get(renderedOrderBlockBoxes, orderBlockIndex))
        array.clear(renderedOrderBlockBoxes)
 
    if array.size(renderedMidpointLines) > 0
        for orderBlockIndex = 0 to array.size(renderedMidpointLines) - 1
            line.delete(array.get(renderedMidpointLines, orderBlockIndex))
        array.clear(renderedMidpointLines)
 
    if array.size(renderedVolumeLabels) > 0
        for orderBlockIndex = 0 to array.size(renderedVolumeLabels) - 1
            label.delete(array.get(renderedVolumeLabels, orderBlockIndex))
        array.clear(renderedVolumeLabels)
 
    int displayedOrderBlockCount = showOrderBlocks ? math.min(maxDisplayedOrderBlocks, array.size(orderBlockTops)) : 0
    float displayedOrderBlockTotalVolume = 0.0
 
    if displayedOrderBlockCount > 0
        for orderBlockIndex = 0 to displayedOrderBlockCount - 1
            displayedOrderBlockTotalVolume += array.get(orderBlockVolumes, orderBlockIndex)
 
    if displayedOrderBlockCount > 0
        for orderBlockIndex = 0 to displayedOrderBlockCount - 1
            float currentBlockTop = array.get(orderBlockTops, orderBlockIndex)
            float currentBlockBottom = array.get(orderBlockBottoms, orderBlockIndex)
            float currentBlockMidpoint = array.get(orderBlockMidpoints, orderBlockIndex)
            int currentBlockStartTime = array.get(orderBlockStartTimes, orderBlockIndex)
            color currentBlockColor = array.get(orderBlockColors, orderBlockIndex)
            float currentBlockVolume = array.get(orderBlockVolumes, orderBlockIndex)
            int bullishActivityEndTime = array.get(bullishActivityEndTimes, orderBlockIndex)
            int bearishActivityEndTime = array.get(bearishActivityEndTimes, orderBlockIndex)
            int bullishActivityCount = array.get(bullishActivityCounts, orderBlockIndex)
            int bearishActivityCount = array.get(bearishActivityCounts, orderBlockIndex)
 
            box orderBlockBackgroundBox = box.new(left = currentBlockStartTime, top = currentBlockTop, right = time, bottom = currentBlockBottom, xloc = xloc.bar_time, border_color = color.new(currentBlockColor, 0), bgcolor = currentBlockColor)
            box orderBlockExtensionBox = box.new(left = time, top = currentBlockTop, right = time + 1, bottom = currentBlockBottom, xloc = xloc.bar_time, border_color = color.new(currentBlockColor, 0), bgcolor = color.new(currentBlockColor, 0))
 
            array.push(renderedOrderBlockBoxes, orderBlockBackgroundBox)
            array.push(renderedOrderBlockBoxes, orderBlockExtensionBox)
 
            if showBuySellActivity
                float totalActivityCount = bullishActivityCount + bearishActivityCount
                float bullishActivityPercentage = totalActivityCount > 0 ? bullishActivityCount / totalActivityCount * 100.0 : 0.0
                float bearishActivityPercentage = totalActivityCount > 0 ? bearishActivityCount / totalActivityCount * 100.0 : 0.0
 
                int bullishActivityTransparency = int(math.round(100.0 - bullishActivityPercentage))
                int bearishActivityTransparency = int(math.round(100.0 - bearishActivityPercentage))
 
                box bullishActivityBox = box.new(left = currentBlockStartTime, top = currentBlockTop, right = math.max(currentBlockStartTime + 1, bullishActivityEndTime), bottom = currentBlockMidpoint, xloc = xloc.bar_time, border_color = bullishActivityColor, bgcolor = color.new(bullishActivityColor, bullishActivityTransparency))
                box bearishActivityBox = box.new(left = currentBlockStartTime, top = currentBlockMidpoint, right = math.max(currentBlockStartTime + 1, bearishActivityEndTime), bottom = currentBlockBottom, xloc = xloc.bar_time, border_color = bearishActivityColor, bgcolor = color.new(bearishActivityColor, bearishActivityTransparency))
 
                array.push(renderedOrderBlockBoxes, bullishActivityBox)
                array.push(renderedOrderBlockBoxes, bearishActivityBox)
 
            if showMidline
                line orderBlockMidpointLine = line.new(x1 = currentBlockStartTime, y1 = currentBlockMidpoint, x2 = time, y2 = currentBlockMidpoint, xloc = xloc.bar_time, color = color.new(currentBlockColor, 0), style = line.style_solid)
                array.push(renderedMidpointLines, orderBlockMidpointLine)
 
            if showVolumeMetrics and displayedOrderBlockTotalVolume > 0
                float orderBlockVolumePercentage = currentBlockVolume / displayedOrderBlockTotalVolume * 100.0
                string volumeMetricText = str.tostring(currentBlockVolume, format.volume) + " (" + str.tostring(math.round(orderBlockVolumePercentage)) + "%)"
 
                label volumeMetricLabel = label.new(x = bar_index + 1, y = currentBlockMidpoint, text = volumeMetricText, xloc = xloc.bar_index, textcolor = color.new(currentBlockColor, 0), style = label.style_label_left, size = getMetricTextSize(metricTextSize), color = #ffffff00)
                array.push(renderedVolumeLabels, volumeMetricLabel)
 
//────────────────────────────────────────────────────
// 20. STRENGTH-BASED BAR COLORS
//────────────────────────────────────────────────────
 
color dynamicBarColor = na
 
if array.size(orderBlockDirections) > 0
    int latestOrderBlockDirection = array.get(orderBlockDirections, 0)
    float currentDirectionStrength = latestOrderBlockDirection == 1 ? currentCandleBullishStrength : currentCandleBearishStrength
 
    currentDirectionStrength := math.max(0.0, math.min(100.0, currentDirectionStrength))
 
    dynamicBarColor := latestOrderBlockDirection == 1 ? color.from_gradient(currentDirectionStrength, 0, 100, color.new(bullishActivityColor, 100), bullishActivityColor) : color.from_gradient(currentDirectionStrength, 0, 100, color.new(bearishActivityColor, 100), bearishActivityColor)
 
    bullishBaseColor := color.from_gradient(currentDirectionStrength, 0, 100, color.new(bullishActivityColor, 100), bullishActivityColor)
    bearishBaseColor := color.from_gradient(currentDirectionStrength, 0, 100, color.new(bearishActivityColor, 100), bearishActivityColor)
 
barcolor(dynamicBarColor)
 
//────────────────────────────────────────────────────
// 21. ORDER BLOCK BOUNDARY TOUCH SIGNALS
//────────────────────────────────────────────────────
 
const string boundarySignalGroup = "06. Order Block Touch Signals"
 
showBoundaryTouchSignals = input.bool(true, "Show Boundary Touch Triangles", group = boundarySignalGroup)
 
bool bullishBoundaryTouched = false
bool bearishBoundaryTouched = false
 
if array.size(orderBlockTops) > 0
    for orderBlockIndex = 0 to array.size(orderBlockTops) - 1
        float currentBlockTop = array.get(orderBlockTops, orderBlockIndex)
        float currentBlockBottom = array.get(orderBlockBottoms, orderBlockIndex)
        int currentBlockDirection = array.get(orderBlockDirections, orderBlockIndex)
 
        bool touchedBlockHigh = high >= currentBlockTop and low <= currentBlockTop
        bool touchedBlockLow = low <= currentBlockBottom and high >= currentBlockBottom
 
        if currentBlockDirection == 1 and (touchedBlockHigh or touchedBlockLow)
            bullishBoundaryTouched := true
 
        if currentBlockDirection == -1 and (touchedBlockHigh or touchedBlockLow)
            bearishBoundaryTouched := true
 
plotshape(showBoundaryTouchSignals and bullishBoundaryTouched, title = "Bullish Order Block Boundary Touch", style = shape.triangleup, location = location.belowbar, color = baseBullishColor, size = size.tiny)
plotshape(showBoundaryTouchSignals and bearishBoundaryTouched, title = "Bearish Order Block Boundary Touch", style = shape.triangledown, location = location.abovebar, color = baseBearishColor, size = size.tiny)

← 返回列表