3-Second Sell Strategy with TP/SL and Time Filters

indicator("Three Second Sell Signal", overlay=true)
bodyTolerance = input.float(0.2, title="Body Similarity Tolerance (%)")
lookbackGreen = input.int(10, title="Lookback for Green Candle")
srLookback = input.int(50, title="S/R Lookback")
srBuffer = input.float(0.003, title="S/R Buffer %")
// Candle conditions
bar1Red = close[1] < open[1]
bar2Red = close < open
body1 = math.abs(close[1] - open[1])
body2 = math.abs(close - open)
bodySimilar = body1 > 0 and math.abs(body1 - body2) / body1 <= bodyTolerance
volumeCondition = volume >= volume[1]
// Last green candle low within lookback
var float recentGreenLow = na
recentGreenLow := na
foundGreen = false
for i = 2 to lookbackGreen + 1
if close > open and not foundGreen
recentGreenLow := low
foundGreen := true
breaksGreenLow = not na(recentGreenLow) and low < recentGreenLow
// Avoid certain minute ranges
minute = minute(time)
avoidTime = (minute >= 13 and minute <= 16) or (minute >= 28 and minute <= 31) or (minute >= 43 and minute <= 46)
// Support/resistance check
highestHigh = ta.highest(high, srLookback)
lowestLow = ta.lowest(low, srLookback)
distToHigh = (highestHigh - close) / close
distToLow = (close - lowestLow) / close
nearSR = distToHigh < srBuffer or distToLow < srBuffer
// Signal logic
sellSignal = bar1Red and bar2Red and bodySimilar and volumeCondition and breaksGreenLow and not avoidTime and not nearSR
plotshape(sellSignal, style=shape.labeldown, color=color.red, size=size.small, title="Sell Signal", location=location.abovebar)
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.