Pine 脚本 - 交易视图

问题描述 投票:0回答:1

Pinescript 程序员..我将 LuxAlgo 的开源交易视图指标(订单块和断路器块 [LuxAlgo])与我的私有指标结合起来..这里的问题是我在图片中向您展示的最后一个 for 循环..它来自 LuxAlgo 指标,它会删除指标之前生成的所有旧方框和线条区域,然后使用此 for 循环之后的下一个代码每分钟重新生成另一个新方框和线条。到目前为止,这很酷,但是两个函数“box”使用的.all'和'line.all',它还删除了我的私人脚本指示器中的所有框和行..那么我应该做什么来限制这两个函数仅适用于LuxAlgo脚本..您可以显示LuxAlgo 指标的开源链接如下: enter image description here https://www.tradingview.com/script/piIbWMpY-Order-Blocks-Breaker-Blocks-LuxAlgo/

我需要你的帮助,我应该如何用 .. 替换 'box.all'、'line.all' 或如何在同一脚本中分离两个指标函数

open-source pine-script-v5 tradingview-api viewpagerindicator combiners
1个回答
0
投票

为 lux 算法指标(框和线)创建的每个项目创建一个数组。创建新的框或线时,将它们推入您创建的数组中,然后最后使用您创建的数组而不是使用 box.all 和 line.all 。例如使用盒子

var boxes = array.new<box>()

method display(ob id, css, break_css)=>
    if id.breaker
        boxes.push(box.new(id.loc, id.top, id.break_loc, id.btm, css.notransp()
          , bgcolor = css
          , xloc = xloc.bar_time))

        boxes.push(box.new(id.break_loc, id.top, time+1, id.btm, na
          , bgcolor = break_css
          , extend = extend.right
          , xloc = xloc.bar_time))
        
        line.new(id.loc, id.top, id.break_loc, id.top, xloc.bar_time, color = css.notransp())
        line.new(id.loc, id.btm, id.break_loc, id.btm, xloc.bar_time, color = css.notransp())
        line.new(id.break_loc, id.top, time+1, id.top, xloc.bar_time, extend.right, break_css.notransp(), line.style_dashed)
        line.new(id.break_loc, id.btm, time+1, id.btm, xloc.bar_time, extend.right, break_css.notransp(), line.style_dashed)
    else
        boxes.push(box.new(id.loc, id.top, time, id.btm, na
          , bgcolor = css
          , extend = extend.right
          , xloc = xloc.bar_time))
        
        line.new(id.loc, id.top, time, id.top, xloc.bar_time, extend.right, css.notransp())
        line.new(id.loc, id.btm, time, id.btm, xloc.bar_time, extend.right, css.notransp())

for bx in boxes
    bx.delete()
© www.soinside.com 2019 - 2024. All rights reserved.