Noise Footprint Imbalance

Random_Noise · study · 36 行 · 点赞 473 · TradingView 原页

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

Pine Script

//@version=5
indicator("Noise Footprint Imbalance", "Noise_Imbalance", true, max_lines_count = 500) 
 
// Inputs
adboxcount = input.int(50, "Maximum Imb Displayed", 1, group = "Chart Customization")
// Removed boxcolor input as per request
 
// Box Variables
var box[] imbboxarray = array.new_box()
 
topimbalance = low[2] <= open[1] and high[0] >= close[1]
topimbalancesize = low[2] - high[0]
bottomimbalance = high[2] >= open[1] and low[0] <= close[1]
bottomimbalancesize = low[0] - high[2]
 
// Box Calc
f_choppedoffimb(imbboxarray) =>
    if array.size(imbboxarray) > 0
        for i = array.size(imbboxarray) - 1 to 0 by 1
            cutbox = array.get(imbboxarray, i)
            boxhighzone = box.get_top(cutbox)
            boxlowzone = box.get_bottom(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(imbboxarray, i), bar_index)
 
// Box Draw
if topimbalance and topimbalancesize > 0 or bottomimbalance and bottomimbalancesize > 0
    boxhighzone = topimbalance and topimbalancesize > 0 ? low[2] : low[0]
    boxlowzone = topimbalance and topimbalancesize > 0 ? high[0] : high[2]
    // Fixed box color to rgb(54, 246, 62)
    imbbox = box.new(bar_index, boxhighzone, bar_index, boxlowzone, color.rgb(54, 246, 62), border_style = line.style_dashed, bgcolor = color.rgb(54, 246, 62))
    if array.size(imbboxarray) > adboxcount
        box.delete(array.shift(imbboxarray))
    array.push(imbboxarray, imbbox)
f_choppedoffimb(imbboxarray)

← 返回列表