OPEN-SOURCE SCRIPT
Daily O/C Span (Real Values & SMA Comparison)

This Pine Script indicator helps you visualize and track the "momentum" or "strength" of each trading day, and compares it to a recent average. It essentially measures the net movement of the price from when the market opens to when it closes.
What the Script Does
The script performs the following actions:
Calculates Daily Movement: For every single trading day, it calculates the difference between the closing price and the opening price (Close - Open).
Plots the "Span": These daily differences are plotted as vertical bars (a histogram) in a separate window below your main price chart.
-Green bars mean the stock closed higher than it opened (a strong day).
-Red bars mean the stock closed lower than it opened (a weak day).
Calculates the Average: It calculates the Simple Moving Average (SMA) of these daily spans over an adjustable period (default is 30 days).
Plots the Average Line: A blue line is plotted over the green/red bars, showing the typical magnitude of daily movement.
Displays Comparison: A table in the top-right corner provides a quick, real-time numerical comparison of today's span versus the 30-day average span.
How It Can Improve Trading
This indicator helps you understand the character and conviction of price action, offering several trading insights:
Gauging Momentum: It clarifies whether the stock's moves are generally strong and sustained within a day (large spans) or hesitant (small spans).
Identifying Trends: During an uptrend, you might expect the average span line to be consistently positive (above zero), and vice versa for a downtrend. A positive average span indicates buyers are consistently closing the day stronger than where they started it.
Spotting Reversals: If a stock is in a strong uptrend but you suddenly see a series of large red bars (large negative spans), it could signal a shift in momentum and potential upcoming reversal.
Volatility Context: By comparing the current day's bar to the blue average line, you can quickly determine if today is an unusually strong/weak day relative to recent history.
In short, it helps you see the underlying buyer/seller conviction within each day, making it easier to gauge the overall market sentiment and anticipate potential shifts.
What the Script Does
The script performs the following actions:
Calculates Daily Movement: For every single trading day, it calculates the difference between the closing price and the opening price (Close - Open).
Plots the "Span": These daily differences are plotted as vertical bars (a histogram) in a separate window below your main price chart.
-Green bars mean the stock closed higher than it opened (a strong day).
-Red bars mean the stock closed lower than it opened (a weak day).
Calculates the Average: It calculates the Simple Moving Average (SMA) of these daily spans over an adjustable period (default is 30 days).
Plots the Average Line: A blue line is plotted over the green/red bars, showing the typical magnitude of daily movement.
Displays Comparison: A table in the top-right corner provides a quick, real-time numerical comparison of today's span versus the 30-day average span.
How It Can Improve Trading
This indicator helps you understand the character and conviction of price action, offering several trading insights:
Gauging Momentum: It clarifies whether the stock's moves are generally strong and sustained within a day (large spans) or hesitant (small spans).
Identifying Trends: During an uptrend, you might expect the average span line to be consistently positive (above zero), and vice versa for a downtrend. A positive average span indicates buyers are consistently closing the day stronger than where they started it.
Spotting Reversals: If a stock is in a strong uptrend but you suddenly see a series of large red bars (large negative spans), it could signal a shift in momentum and potential upcoming reversal.
Volatility Context: By comparing the current day's bar to the blue average line, you can quickly determine if today is an unusually strong/weak day relative to recent history.
In short, it helps you see the underlying buyer/seller conviction within each day, making it easier to gauge the overall market sentiment and anticipate potential shifts.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.