如果未在1 bar中触发订单,如何取消订单?

发布于 2025-01-28 17:25:24 字数 136 浏览 2 评论 0原文

我如何防止订单以后保持打开和执行。

对于长篇小说,我有一个buystop = high,因此,如果下一个蜡烛没有达到高价,它将保持开放,直到X蜡烛打印数量并最终达到有效的蜡烛高价。

有效的长/短条目后,我们是否有能力仅执行一个条?

How do i prevent orders from remaining open and executing later.

For long entries i have a buystop = high, so if the next candle the price doesn't hit the high it'll remain open until x number of candles print and finally price hits the valid candle high price.

Do we have the ability to only execute one bar after valid long/short entry?

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

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

发布评论

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

评论(1

云淡风轻 2025-02-04 17:25:24

假设您通常在这样做这样的事情:

long_cond = something

if (long_cond)
    strategy.entry("Long", strategy.long)

然后,您可以检查您的条件是否为true一个bar前,以及目前是否不处于较长的位置。

is_long = strategy.position_size > 0
cancel_long_order = barstate.isconfirmed and long_cond[1] and not is_long

if (cancel_long_order)
    strategy.cancel("Long")

Let's say you are normally doing something like this:

long_cond = something

if (long_cond)
    strategy.entry("Long", strategy.long)

You can then check if your condition was true one bar ago and if you are not in a long position at the moment.

is_long = strategy.position_size > 0
cancel_long_order = barstate.isconfirmed and long_cond[1] and not is_long

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