情节停止损失并在图表上获利,Pinescript

发布于 2025-01-26 18:18:06 字数 84 浏览 0 评论 0原文

我已经定义了价格水平可以以该价格关闭交易的方法,但是我想从视觉上显示水平,只是在视觉上验证它们。 我是新手,找不到有关方法的帮助。在其他来源上执行此操作。

I have defined the price levels have a way to close trades at that price, but i want to visually show the levels, just to visually verify them.
Im new and could not find help on how to. Do this on other sources.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贪恋 2025-02-02 18:18:06

如果您已经计算了价格,则只需绘制它们即可。

这是策略(“”,Overlay = true)的一个示例

in_long_tp_per = input.float(2.0, "Take profit %") * 0.01
in_long_sl_per = input.float(1.0, "Stop loss %") * 0.01

long_tp_price = strategy.position_avg_price * (1 + in_long_tp_per)
long_sl_price = strategy.position_avg_price * (1 - in_long_sl_per)

if (strategy.position_size > 0)
    strategy.exit("exit", "long", limit = long_tp_price, stop = long_sl_price)

plot(long_tp_price , "TP", color.green, 2, plot.style_circles)
plot(long_sl_price , "SL", color.red, 2, plot.style_circles)

If you already calculated the prices then just plot them.

This is an example for a strategy("", overlay=true)

in_long_tp_per = input.float(2.0, "Take profit %") * 0.01
in_long_sl_per = input.float(1.0, "Stop loss %") * 0.01

long_tp_price = strategy.position_avg_price * (1 + in_long_tp_per)
long_sl_price = strategy.position_avg_price * (1 - in_long_sl_per)

if (strategy.position_size > 0)
    strategy.exit("exit", "long", limit = long_tp_price, stop = long_sl_price)

plot(long_tp_price , "TP", color.green, 2, plot.style_circles)
plot(long_sl_price , "SL", color.red, 2, plot.style_circles)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文