OPEN-SOURCE SCRIPT
Simple Trend + Signal (No Bug)

//version=5
indicator("Simple Trend + Signal (No Bug)", overlay=true)
// === INPUTS ===
fastEMA = input.int(20, "Fast EMA")
slowEMA = input.int(50, "Slow EMA")
lookback = input.int(20, "Zone Lookback")
// === TREND ===
emaFast = ta.ema(close, fastEMA)
emaSlow = ta.ema(close, slowEMA)
trendUp = emaFast > emaSlow
trendDown = emaFast < emaSlow
// === ZONES ===
highestHigh = ta.highest(high, lookback)
lowestLow = ta.lowest(low, lookback)
// === SIGNALS ===
buySignal = trendUp and close <= emaFast
sellSignal = trendDown and close >= emaFast
// === PLOTS ===
plot(emaFast, color=color.green, linewidth=2)
plot(emaSlow, color=color.red, linewidth=2)
plot(highestHigh, color=color.new(color.blue, 70))
plot(lowestLow, color=color.new(color.orange, 70))
plotshape(buySignal, title="BUY", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="SELL", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
indicator("Simple Trend + Signal (No Bug)", overlay=true)
// === INPUTS ===
fastEMA = input.int(20, "Fast EMA")
slowEMA = input.int(50, "Slow EMA")
lookback = input.int(20, "Zone Lookback")
// === TREND ===
emaFast = ta.ema(close, fastEMA)
emaSlow = ta.ema(close, slowEMA)
trendUp = emaFast > emaSlow
trendDown = emaFast < emaSlow
// === ZONES ===
highestHigh = ta.highest(high, lookback)
lowestLow = ta.lowest(low, lookback)
// === SIGNALS ===
buySignal = trendUp and close <= emaFast
sellSignal = trendDown and close >= emaFast
// === PLOTS ===
plot(emaFast, color=color.green, linewidth=2)
plot(emaSlow, color=color.red, linewidth=2)
plot(highestHigh, color=color.new(color.blue, 70))
plot(lowestLow, color=color.new(color.orange, 70))
plotshape(buySignal, title="BUY", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="SELL", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.