OPEN-SOURCE SCRIPT

Anti-PDT Swing Trade Signals

24
//version=5
indicator("Anti-PDT Swing Trade Signals", overlay=true)

// === User Inputs ===
priceLimit = input.float(25, "Max Price ($)", minval=1)
minVolume = input.int(200000, "Min Avg Volume (10D)", minval=1)

// === Indicators ===
sma20 = ta.sma(close, 20)
sma50 = ta.sma(close, 50)
macdLine = ta.ema(close, 12) - ta.ema(close, 26)
signalLine = ta.ema(macdLine, 9)
rsi = ta.rsi(close, 14)
avgVolume = ta.sma(volume, 10)

// === Conditions ===
priceFilter = close <= priceLimit
volumeFilter = avgVolume >= minVolume
rsiFilter = ta.crossover(rsi, 40)
macdFilter = ta.crossover(macdLine, signalLine)
smaFilter = close > sma20 and close > sma50
momentumFilter = close > close[5] * 1.03 and close < close[5] * 1.10

// === Day Filter ===
isMonWedFri = dayofweek == dayofweek.monday or dayofweek == dayofweek.wednesday or dayofweek == dayofweek.friday

entryCondition = priceFilter and volumeFilter and rsiFilter and macdFilter and smaFilter and momentumFilter and isMonWedFri

// === Alerts & Visuals ===
plotshape(entryCondition, title="BUY", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
alertcondition(entryCondition, title="BUY Alert", message="BUY Signal: {{ticker}} meets swing trading entry criteria.")
plot(sma20, color=color.orange)
plot(sma50, color=color.blue)

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.