OPEN-SOURCE SCRIPT

Strong/Weak Single Levels

//version=5
indicator("Strong/Weak Single Levels", overlay=true)

// Input thresholds for strong and weak candles
strongCandleSize = input.float(1.5, title="Strong Candle Size (x ATR)")
weakCandleSize = input.float(0.5, title="Weak Candle Size (x ATR)")

// Calculate ATR for relative size comparison
atr = ta.atr(14)

// Identify strong and weak candles
isStrongGreen = (close - open) > strongCandleSize * atr
isWeakGreen = (close - open) > weakCandleSize * atr and (close - open) <= strongCandleSize * atr
isStrongRed = (open - close) > strongCandleSize * atr

// Check for strong and weak single levels
strongLevel = ta.valuewhen(isStrongGreen and isStrongRed[1], high[1], 0)
weakLevel = ta.valuewhen(isWeakGreen and isStrongRed[1], high[1], 0)

// Plot horizontal lines for levels
if strongLevel
line.new(x1=bar_index[1], y1=strongLevel, x2=bar_index, y2=strongLevel, color=color.green, width=2, extend=extend.right)
if weakLevel
line.new(x1=bar_index[1], y1=weakLevel, x2=bar_index, y2=weakLevel, color=color.red, width=2, extend=extend.right)
Chart patterns

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明