OPEN-SOURCE SCRIPT
Enhanced Stock Ticker with 50MA vs 200MA

Description:
The "Enhanced Stock Ticker with 50MA vs 200MA" is a powerful Pine Script indicator designed to help traders analyze a stock’s price position within short-term (default: 50-period) and long-term (default: 200-period) price ranges. It provides normalized price indices, visual crossover signals, and a user-friendly interface to identify potential bullish or bearish trends, making it ideal for trend-following and reversal strategies.
What It Does:
Normalized Price Indices:
Calculates two indices based on the stock’s closing price relative to the high/low range over user-defined short (default: 50 periods) and long (default: 200 periods) lookback periods.
The Short Lookback Index (blue line) shows where the current price sits within the 50-period high/low range, scaled from 0 to 100.
The Long Lookback Index (white line) does the same for the 200-period range.
Both indices are plotted on a separate 0–100 scale for easy comparison.
Visual Aids:
Horizontal Lines: Dashed lines at 0, 20, 50, 80, and 100 mark key levels. The 20 and 80 lines indicate lower and upper thresholds, respectively, while 50 represents the midpoint.
Color Fills: Green fill between 0–20 (oversold zone) and red fill between 80–100 (overbought zone) highlight key price zones.
Dynamic Fill Between Indices: A green fill appears when the short-term index is above the long-term index (bullish), and a red fill appears when it’s below (bearish).
Crossover Signals:
Long-Term Signals:
Bullish Long Cross: A green triangle appears at the bottom when the Long Lookback Index crosses above 5, indicating a potential valley or bullish reversal.
Bearish Long Cross: A red triangle appears at the top when the Long Lookback Index crosses below 95, signaling a potential peak or bearish reversal.
Short-Term Signals:
Bullish Short Cross: A blue triangle appears at the bottom when the Short Lookback Index crosses above 5, suggesting short-term bullish momentum.
Bearish Short Cross: A white triangle appears at the top when the Short Lookback Index crosses below 95, indicating short-term bearish momentum.
All signals are available as alert conditions for integration with TradingView’s alert system.
Ticker and Legend Table:
Displays a table in the top-right corner with:
The stock’s ticker symbol (yellow text on blue background).
A legend explaining the blue line (Short MA, 50 periods) and white line (Long MA, 200 periods).
The table is color-coded for clarity and initializes only once to avoid clutter.
Commented-Out Features:
The code includes an optional histogram (currently disabled) that can be uncommented to display the difference between the short and long indices for additional analysis.
How to Use:
Customization: Adjust the short (default: 50) and long (default: 200) lookback periods in the indicator settings to suit your trading style or timeframe.
Interpretation:
When the blue line (Short Lookback Index) is above the white line (Long Lookback Index), it suggests short-term strength relative to the long-term trend (bullish bias).
When the blue line is below the white line, it indicates short-term weakness (bearish bias).
Watch for crossover signals at the 5 (valley) and 95 (peak) levels for potential entry or exit points.
Alerts: Set up TradingView alerts for the following conditions:
Long Index Valley: Long-term bullish crossover above 5.
Long Index Peak: Long-term bearish crossover below 95.
Short Index Valley: Short-term bullish crossover above 5.
Short Index Peak: Short-term bearish crossover below 95.
Why Use This Indicator?
This indicator offers a normalized view of price action, combining short- and long-term trend analysis with clear visual cues and actionable signals. The crossover markers and alert conditions make it easy to spot potential reversals or trend continuations, while the customizable periods and clean design cater to traders of all experience levels.
Notes:
Uses confirmed bars (previous bar’s OHLC data) to ensure accuracy and prevent repainting.
Primarily designed for stocks but adaptable to other assets (e.g., forex, crypto) by adjusting lookback periods.
Uncomment the histogram code if you prefer a visual representation of the index difference.
Signals at 5 and 95 thresholds are sensitive to extreme price movements, so combine with other analysis for confirmation.
The "Enhanced Stock Ticker with 50MA vs 200MA" is a powerful Pine Script indicator designed to help traders analyze a stock’s price position within short-term (default: 50-period) and long-term (default: 200-period) price ranges. It provides normalized price indices, visual crossover signals, and a user-friendly interface to identify potential bullish or bearish trends, making it ideal for trend-following and reversal strategies.
What It Does:
Normalized Price Indices:
Calculates two indices based on the stock’s closing price relative to the high/low range over user-defined short (default: 50 periods) and long (default: 200 periods) lookback periods.
The Short Lookback Index (blue line) shows where the current price sits within the 50-period high/low range, scaled from 0 to 100.
The Long Lookback Index (white line) does the same for the 200-period range.
Both indices are plotted on a separate 0–100 scale for easy comparison.
Visual Aids:
Horizontal Lines: Dashed lines at 0, 20, 50, 80, and 100 mark key levels. The 20 and 80 lines indicate lower and upper thresholds, respectively, while 50 represents the midpoint.
Color Fills: Green fill between 0–20 (oversold zone) and red fill between 80–100 (overbought zone) highlight key price zones.
Dynamic Fill Between Indices: A green fill appears when the short-term index is above the long-term index (bullish), and a red fill appears when it’s below (bearish).
Crossover Signals:
Long-Term Signals:
Bullish Long Cross: A green triangle appears at the bottom when the Long Lookback Index crosses above 5, indicating a potential valley or bullish reversal.
Bearish Long Cross: A red triangle appears at the top when the Long Lookback Index crosses below 95, signaling a potential peak or bearish reversal.
Short-Term Signals:
Bullish Short Cross: A blue triangle appears at the bottom when the Short Lookback Index crosses above 5, suggesting short-term bullish momentum.
Bearish Short Cross: A white triangle appears at the top when the Short Lookback Index crosses below 95, indicating short-term bearish momentum.
All signals are available as alert conditions for integration with TradingView’s alert system.
Ticker and Legend Table:
Displays a table in the top-right corner with:
The stock’s ticker symbol (yellow text on blue background).
A legend explaining the blue line (Short MA, 50 periods) and white line (Long MA, 200 periods).
The table is color-coded for clarity and initializes only once to avoid clutter.
Commented-Out Features:
The code includes an optional histogram (currently disabled) that can be uncommented to display the difference between the short and long indices for additional analysis.
How to Use:
Customization: Adjust the short (default: 50) and long (default: 200) lookback periods in the indicator settings to suit your trading style or timeframe.
Interpretation:
When the blue line (Short Lookback Index) is above the white line (Long Lookback Index), it suggests short-term strength relative to the long-term trend (bullish bias).
When the blue line is below the white line, it indicates short-term weakness (bearish bias).
Watch for crossover signals at the 5 (valley) and 95 (peak) levels for potential entry or exit points.
Alerts: Set up TradingView alerts for the following conditions:
Long Index Valley: Long-term bullish crossover above 5.
Long Index Peak: Long-term bearish crossover below 95.
Short Index Valley: Short-term bullish crossover above 5.
Short Index Peak: Short-term bearish crossover below 95.
Why Use This Indicator?
This indicator offers a normalized view of price action, combining short- and long-term trend analysis with clear visual cues and actionable signals. The crossover markers and alert conditions make it easy to spot potential reversals or trend continuations, while the customizable periods and clean design cater to traders of all experience levels.
Notes:
Uses confirmed bars (previous bar’s OHLC data) to ensure accuracy and prevent repainting.
Primarily designed for stocks but adaptable to other assets (e.g., forex, crypto) by adjusting lookback periods.
Uncomment the histogram code if you prefer a visual representation of the index difference.
Signals at 5 and 95 thresholds are sensitive to extreme price movements, so combine with other analysis for confirmation.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.