OPEN-SOURCE SCRIPT

Anti-PDT Swing Trade Signals

28
//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)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.