OPEN-SOURCE SCRIPT
Swing & Short Term

//version=6
indicator("Swing & Short Term", overlay=true)
// Input
len = input.int(14, "Williams %R Length")
// Multi-timeframe Williams %R
wprDay = request.security(syminfo.tickerid, "D", ta.wpr(len))
wprWeek = request.security(syminfo.tickerid, "W", ta.wpr(len))
wpr1H = request.security(syminfo.tickerid, "60", ta.wpr(len))
// Conditions
buyCond = (wprDay > -30 and wprWeek > -30 and wpr1H > -30)
sellCond = (wprDay < -40 and wprWeek < -40 and wpr1H < -40)
// Track last signal
var int lastSignal = 0 // 0 = none, 1 = buy, -1 = sell
buySignal = buyCond and lastSignal != 1
sellSignal = sellCond and lastSignal != -1
if buySignal
lastSignal := 1
if sellSignal
lastSignal := -1
// Plot signals
plotshape(buySignal, title="Buy", location=location.belowbar,
style=shape.triangleup, color=color.green, size=size.small, text="BUY")
plotshape(sellSignal, title="Sell", location=location.abovebar,
style=shape.triangledown, color=color.red, size=size.small, text="SELL")
// Alerts
alertcondition(buySignal, title="Buy Alert", message="BUY: D/W/1H W%R > -30")
alertcondition(sellSignal, title="Sell Alert", message="SELL: D/W/1H W%R < -40")
// Reference lines
hline(-30, "Overbought", color=color.red)
hline(-40, "Sell Threshold", color=color.gray)
indicator("Swing & Short Term", overlay=true)
// Input
len = input.int(14, "Williams %R Length")
// Multi-timeframe Williams %R
wprDay = request.security(syminfo.tickerid, "D", ta.wpr(len))
wprWeek = request.security(syminfo.tickerid, "W", ta.wpr(len))
wpr1H = request.security(syminfo.tickerid, "60", ta.wpr(len))
// Conditions
buyCond = (wprDay > -30 and wprWeek > -30 and wpr1H > -30)
sellCond = (wprDay < -40 and wprWeek < -40 and wpr1H < -40)
// Track last signal
var int lastSignal = 0 // 0 = none, 1 = buy, -1 = sell
buySignal = buyCond and lastSignal != 1
sellSignal = sellCond and lastSignal != -1
if buySignal
lastSignal := 1
if sellSignal
lastSignal := -1
// Plot signals
plotshape(buySignal, title="Buy", location=location.belowbar,
style=shape.triangleup, color=color.green, size=size.small, text="BUY")
plotshape(sellSignal, title="Sell", location=location.abovebar,
style=shape.triangledown, color=color.red, size=size.small, text="SELL")
// Alerts
alertcondition(buySignal, title="Buy Alert", message="BUY: D/W/1H W%R > -30")
alertcondition(sellSignal, title="Sell Alert", message="SELL: D/W/1H W%R < -40")
// Reference lines
hline(-30, "Overbought", color=color.red)
hline(-40, "Sell Threshold", color=color.gray)
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.