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精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明