如何更改 plotshape 与蜡烛的距离

how to change the distance of plotshape from the candle

我希望能够指定绘图形状的距离。 我发现这个 post 相关,但那里没有有用的答案。

所以基本上我希望能够指定箭头与蜡烛顶部的距离,所以稍后我能够在蜡烛顶部绘制多个箭头。 例如:

我希望最终能够做到这一点

如果你想为此使用 plotshape(),请将你的 location 参数设置为 location.absolute。然后调整仓位价格。

您也可以使用 labels

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

//@version=5
indicator("My script", overlay = true)

atr = ta.atr(10)
pos1 = high + (1 * atr)
pos2 = high + (2 * atr)
pos3 = high + (3 * atr)
c = barstate.islast

plotshape(c ? pos1 : na , "One", shape.xcross, location.absolute, color.red, 0, "One")
plotshape(c ? pos2 : na , "Two", shape.diamond, location.absolute, color.yellow, 0, "Two")
plotshape(c ? pos3 : na , "Three", shape.square, location.absolute, color.green, 0, "Three")