OPEN-SOURCE SCRIPT
SMA Crossover High/Low Lines

SMA Crossover High/Low Lines (version=5)
Purpose
This indicator plots horizontal lines and optional price labels on the high and low of candles where the price crosses a Simple Moving Average (SMA). It helps identify buy/sell signals visually on the chart.
Inputs
smaLength – Length of the SMA (default: 50).
showType – Which crossovers to show: "Both", "Buy Only", or "Sell Only".
lineLength – How many bars the horizontal line extends (default: 10).
showPriceLabels – Whether to show price labels at crossover points (true/false).
Logic
SMA Calculation – Computes a simple moving average of the closing price.
Crossover Detection:
crossUp → price crosses above SMA (buy signal).
crossDown → price crosses below SMA (sell signal).
Draw Horizontal Lines – At candle high and low of crossover:
Green for buy (crossUp)
Red for sell (crossDown)
Lines extend for lineLength bars
Optional Labels – Shows the high/low price at the end of the horizontal line if showPriceLabels is true.
Visualization
SMA line plotted in blue.
Buy crossovers → green horizontal lines and labels.
Sell crossovers → red horizontal lines and labels.
In short:
This indicator highlights buy/sell points where price crosses the SMA by marking candle highs/lows with colored lines and optional price labels for easy visual reference.
Purpose
This indicator plots horizontal lines and optional price labels on the high and low of candles where the price crosses a Simple Moving Average (SMA). It helps identify buy/sell signals visually on the chart.
Inputs
smaLength – Length of the SMA (default: 50).
showType – Which crossovers to show: "Both", "Buy Only", or "Sell Only".
lineLength – How many bars the horizontal line extends (default: 10).
showPriceLabels – Whether to show price labels at crossover points (true/false).
Logic
SMA Calculation – Computes a simple moving average of the closing price.
Crossover Detection:
crossUp → price crosses above SMA (buy signal).
crossDown → price crosses below SMA (sell signal).
Draw Horizontal Lines – At candle high and low of crossover:
Green for buy (crossUp)
Red for sell (crossDown)
Lines extend for lineLength bars
Optional Labels – Shows the high/low price at the end of the horizontal line if showPriceLabels is true.
Visualization
SMA line plotted in blue.
Buy crossovers → green horizontal lines and labels.
Sell crossovers → red horizontal lines and labels.
In short:
This indicator highlights buy/sell points where price crosses the SMA by marking candle highs/lows with colored lines and optional price labels for easy visual reference.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.