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

时间:2021-07-14 19:36:17

标签: pine-script candlestick-chart candlesticks

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

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

指标检测最高红色蜡烛的主要思想,上面的故事超过蜡烛长度的 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", type=input.integer, 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 根蜡烛和它的盒子,但我可以增加或减少它作为输入

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

0 个答案:

没有答案