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.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.