PROTECTED SOURCE SCRIPT
TS vela anterior (M15)

This script detects a “TS” (sweep + close back inside) against the immediately previous candle (1-bar), and it triggers only after the candle closes.
What it considers a “TS” (vs the previous candle)
1) Bearish TS (marker above the candle)
It flags a bearish TS when the current candle:
Breaks above the previous candle’s high (high > high[1])
Then closes back below that previous high (close < high[1])
And the close is still inside the previous candle’s range (close > low[1])
Extra filter you requested: the candle must be bearish (black) → close < open
2) Bullish TS (marker below the candle)
It flags a bullish TS when the current candle:
Breaks below the previous candle’s low (low < low[1])
Then closes back above that previous low (close > low[1])
And the close is inside the previous candle’s range (close < high[1])
Extra filter you requested: the candle must be bullish (white) → close > open
What it does when a TS is detected
Plots a small “TS” triangle:
Above the candle for bearish TS
Below the candle for bullish TS
Provides alert conditions so you can create TradingView alerts for:
Any TS
Bearish TS only
Bullish TS only
Notes
It detects TS only against the previous candle (1-bar), not against multi-candle swing highs/lows.
Doji candles (close == open) are excluded by the bullish/bearish color filter.
What it considers a “TS” (vs the previous candle)
1) Bearish TS (marker above the candle)
It flags a bearish TS when the current candle:
Breaks above the previous candle’s high (high > high[1])
Then closes back below that previous high (close < high[1])
And the close is still inside the previous candle’s range (close > low[1])
Extra filter you requested: the candle must be bearish (black) → close < open
2) Bullish TS (marker below the candle)
It flags a bullish TS when the current candle:
Breaks below the previous candle’s low (low < low[1])
Then closes back above that previous low (close > low[1])
And the close is inside the previous candle’s range (close < high[1])
Extra filter you requested: the candle must be bullish (white) → close > open
What it does when a TS is detected
Plots a small “TS” triangle:
Above the candle for bearish TS
Below the candle for bullish TS
Provides alert conditions so you can create TradingView alerts for:
Any TS
Bearish TS only
Bullish TS only
Notes
It detects TS only against the previous candle (1-bar), not against multi-candle swing highs/lows.
Doji candles (close == open) are excluded by the bullish/bearish color filter.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 이를 자유롭게 제한 없이 사용할 수 있습니다 – 자세한 내용은 여기에서 확인하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 이를 자유롭게 제한 없이 사용할 수 있습니다 – 자세한 내용은 여기에서 확인하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.