OPEN-SOURCE SCRIPT
Weekly TrendRider longPosition 5% Zone

//version=5
indicator("Weekly EMA21 Dynamic Zone", overlay=true)
// ======================================================
// TIMEFRAME RESTRICTION
// ======================================================
// Check if chart timeframe is Weekly
isWeekly = timeframe.isweekly
// If not Weekly → show message and stop plots
if not isWeekly
label.new(bar_index, high,
"This indicator works only on Weekly timeframe",
style=label.style_label_center,
color=color.red,
textcolor=color.white,
size=size.large)
// ======================================================
// WEEKLY EMA21 CALCULATION
// ======================================================
ema21 = ta.ema(close, 21)
// Upper and Lower Levels (5% zones)
upperLevel = ema21 * 1.05
lowerLevel = ema21 * 0.95
// ======================================================
// CONDITIONAL PLOTTING (Hide on other timeframes)
// ======================================================
plotEMA = isWeekly ? ema21 : na
plotUpper = isWeekly ? upperLevel : na
plotLower = isWeekly ? lowerLevel : na
// Plot EMA
emaPlot = plot(plotEMA,
title="EMA 21",
color=color.orange,
linewidth=2)
// Plot Upper & Lower Levels
upperPlot = plot(plotUpper,
title="Upper 5% Zone",
color=color.green)
lowerPlot = plot(plotLower,
title="Lower 5% Zone",
color=color.red)
// ======================================================
// ZONE FILLING
// ======================================================
// Green Zone (EMA → +5%)
fill(emaPlot, upperPlot,
color=isWeekly ? color.new(color.green, 85) : na)
// Red Zone (EMA → -5%)
fill(emaPlot, lowerPlot,
color=isWeekly ? color.new(color.red, 85) : na)
indicator("Weekly EMA21 Dynamic Zone", overlay=true)
// ======================================================
// TIMEFRAME RESTRICTION
// ======================================================
// Check if chart timeframe is Weekly
isWeekly = timeframe.isweekly
// If not Weekly → show message and stop plots
if not isWeekly
label.new(bar_index, high,
"This indicator works only on Weekly timeframe",
style=label.style_label_center,
color=color.red,
textcolor=color.white,
size=size.large)
// ======================================================
// WEEKLY EMA21 CALCULATION
// ======================================================
ema21 = ta.ema(close, 21)
// Upper and Lower Levels (5% zones)
upperLevel = ema21 * 1.05
lowerLevel = ema21 * 0.95
// ======================================================
// CONDITIONAL PLOTTING (Hide on other timeframes)
// ======================================================
plotEMA = isWeekly ? ema21 : na
plotUpper = isWeekly ? upperLevel : na
plotLower = isWeekly ? lowerLevel : na
// Plot EMA
emaPlot = plot(plotEMA,
title="EMA 21",
color=color.orange,
linewidth=2)
// Plot Upper & Lower Levels
upperPlot = plot(plotUpper,
title="Upper 5% Zone",
color=color.green)
lowerPlot = plot(plotLower,
title="Lower 5% Zone",
color=color.red)
// ======================================================
// ZONE FILLING
// ======================================================
// Green Zone (EMA → +5%)
fill(emaPlot, upperPlot,
color=isWeekly ? color.new(color.green, 85) : na)
// Red Zone (EMA → -5%)
fill(emaPlot, lowerPlot,
color=isWeekly ? color.new(color.red, 85) : na)
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน