趋势吞噬蜡烛

时间:2021-01-16 22:47:02

标签: tradingview-api

当绿色蜡烛吞没红色蜡烛时,无论是 1 根蜡烛还是 2 根或 3 根蜡烛,我都试图显示买入入场。而不仅仅是它旁边的那个...购买 我只希望购买显示在那根蜡烛上,而不是在它之后的所有蜡烛上显示,直到下一个红色蜡烛。然后这个过程重新开始。 已修改...我遗漏了部分情节代码...这是正确的

//@version=4
study(title="Engulfing Candle with Step Limit", overlay=true)


stepLimit = 1

bullishEC = false
bearishEC = false

// Identify engulfing candles
for i = 1 to stepLimit by 1
    bullishEC := close >= open[i] and close[i] < open[i] and close > open
    bearishEC := close <= open[i] and close[i] > open[i] and close < open
    if (bullishEC or bearishEC)
        break
    
plotshape(bearishEC, location = location.abovebar, color = color.red, transp = 0, style = shape.triangledown, text = "Sell")
plotshape(bullishEC, location = location.belowbar, color = color.green, transp = 0, style = shape.triangleup, text = "Buy")

0 个答案:

没有答案