如果有六支绿色蜡烛,则在进入该职位之前,请不要进入

发布于 2025-01-22 01:49:28 字数 462 浏览 4 评论 0原文

我想制作一个不会在图片中的情况下进入位置的代码。

    greenCandle = barstate.isconfirmed and (close > open)
    
    sixGreenCandles = greenCandle[6] and greenCandle[5] and greenCandle[4] and greenCandle[3] and greenCandle[2] and greenCandle[1]

我不知道进入该位置之前要计算蜡烛的代码

(信号处的蜡烛除外)

I'd like to make a code that won't entering the position in a situation like in the picture.

enter image description here

    greenCandle = barstate.isconfirmed and (close > open)
    
    sixGreenCandles = greenCandle[6] and greenCandle[5] and greenCandle[4] and greenCandle[3] and greenCandle[2] and greenCandle[1]

I don't know the code to count the candle before entering the position

(Except for the candles at the signal)

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

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

发布评论

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

评论(1

绝情姑娘 2025-01-29 01:49:28

您可以使用ta.barss()函数来弄清最后一个红色蜡烛。然后添加一个检查当前条之前是否少于6。与其他购买条件一起使用此条件。

//@version=5
indicator("My script")

red_candle = (close < open)
since_last_red = ta.barssince(red_candle)
can_buy = (since_last_red[1] < 6)

plot(since_last_red)

You can use the ta.barssince() function to figure out when the last red candle was. Then add a check whether this was less than 6 before the current bar. Use this condition together with your other buy conditions.

//@version=5
indicator("My script")

red_candle = (close < open)
since_last_red = ta.barssince(red_candle)
can_buy = (since_last_red[1] < 6)

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