更改 pine 脚本中的进入/退出文本和颜色

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

是否可以更改 pine 脚本中的进入和退出文本和颜色?

目前入口为蓝色,出口为粉色。

谢谢

pine-script
2个回答
0
投票

不,但您可以添加自己的标签并隐藏内置标签。

要禁用图表上的内置交易标签,只需转到“设置”->“样式”并取消选中“图表上的交易”选项即可。

enter image description here

请参阅下面的示例:

// 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
strategy("My strategy", overlay=true, margin_long=100, margin_short=100)

long_color = input.color(color.green, "Long Color")
short_color = input.color(color.red, "Short Color")
text_color = input.color(color.white, "Text Color")

is_new_long = (strategy.position_size > 0) and (strategy.position_size > strategy.position_size[1])
is_new_short = (strategy.position_size < 0) and (strategy.position_size < strategy.position_size[1])

longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)

shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)

plotshape(is_new_long, "Long", shape.labeldown, location.abovebar, long_color, 0, "Long", text_color)
plotshape(is_new_short, "Short", shape.labelup, location.belowbar, short_color, 0, "Short", text_color)

enter image description here


0
投票

例如使用strategy.exit怎么样

strategy.exit("EXIT " + Morningbearentry, from_entry = Morningbearentry, stop=stopLevelBearish, limit=targetLevelBearish)

如何更改它以也使用标签?

© www.soinside.com 2019 - 2024. All rights reserved.