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)
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน