如何在 Pine Script 中的特定蜡烛上绘制自动框?

问题描述

我正在尝试编写一个显示阻力区域的指标

阻力区域应为方框(三角形)

指标检测最高红色蜡烛的主要思想,上面的故事超过蜡烛长度的 50%

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TEST

//@version=4
study("--- TEST --- ",overlay=true)

redbar = close < open
greenbar = close > open
low_tale = min(close,open) - low
upper_tale = high - max(open,close)
candle_length = high - low


hiLen = input(title="High Length",type=input.integer,defval=25)
hiHighs = highest(high,hiLen)[1]

loLen = input(title="Low Length",defval=25)
loLows = lowest(low,loLen)[1]


if redbar and upper_tale > ( 0.5 * candle_length ) and high > hiHighs
    label.new(bar_index,high,"Short",yloc = yloc.abovebar,color = color.red,style = label.style_arrowdown)

现在显示的演示图像

it shows red arrows,but I wanna it show a box

这就是我想做的

enter image description here

  • 我想用相同的条件显示最后 4 根蜡烛和它的盒子,但我可以增加或减少它作为输入

**当然盒子的顶部是目标蜡烛的高点,盒子的低点是目标蜡烛的低点

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)