PROTECTED SOURCE SCRIPT

ItsGuarantee Instrument Net Change Real-Time

99
Description of the Indicator
The "ItsGuarantee Instrument Net Change Real-Time" is a Pine Script (version 5) indicator developed for TradingView to provide real-time net price change metrics for a financial instrument across three timeframes: Year-to-Date (YTD), Month-to-Date (MTD), and Day-to-Date (DTD). It calculates the difference between the instrument's current closing price and its opening price at the start of the year, month, and day, respectively. These net changes are displayed in a customizable table overlaid on the chart, enabling traders to quickly assess the instrument's performance over these periods without manual calculations.
Key Features:
Real-Time Net Change Calculation:
YTD Net Change: Measures the difference between the current price and the opening price on January 1, 2025 (or the specified year).

MTD Net Change: Calculates the difference between the current price and the opening price at the beginning of the current month.

DTD Net Change: Computes the difference between the current price and the opening price of the current trading day.

Customizable Table Display:
The table's position on the chart can be adjusted via a user input dropdown, with options including "top_right," "top_left," "middle_right," "middle_left," "bottom_right," or "bottom_left."

The table is structured with two columns ("Metric" and "Value") and four rows (a header row followed by three rows for the net change metrics).

It features a clean design with a gray header and white cells, accented by a border for improved readability.

Overlay on Chart:
The indicator operates in overlay=true mode, meaning the table is displayed directly on the price chart rather than in a separate pane, allowing traders to view performance metrics alongside price action seamlessly.

Error Handling:
If data for a specific timeframe (e.g., the yearly open price) is unavailable (na), the table displays "N/A" instead of a numerical value, ensuring the indicator remains functional even with incomplete data.

How It Works:
Inputs:
The script defines the starting year for the YTD calculation (default is 2025) and includes an input for the table's position on the chart.

A switch statement maps the user-selected table position (e.g., "top_right") to the corresponding Pine Script position constant (e.g., position.top_right).

Data Retrieval:
The current price is sourced using the close variable, which updates in real-time as new price data becomes available.

Historical opening prices for the year, month, and day are retrieved using request.security, pulling data from the specified timeframes ("12M" for yearly, "M" for monthly, "D" for daily). The barmerge parameters ensure accurate data alignment without gaps or lookahead bias.

Net Change Calculations:
YTD Net Change = Current Price - Yearly Open Price (January 1, 2025)

MTD Net Change = Current Price - Monthly Open Price (start of the current month)

DTD Net Change = Current Price - Daily Open Price (start of the current trading day)

The na function checks for missing data to prevent errors during calculations.

Table Creation and Population:
A table is created using table.new with 2 columns and 4 rows, positioned according to the user's input.

The first row serves as a header with "Metric" and "Value" labels, styled with a gray background and white text for contrast.

The subsequent rows display the YTD, MTD, and DTD net changes in dollars, formatted to two decimal places using str.tostring. If a value is unavailable, it displays "N/A."

Use Case for Traders:
This indicator is highly practical for traders and investors who need to monitor an instrument's performance across different timeframes without performing manual calculations. Specific use cases include:
Day Traders: The DTD net change provides a snapshot of intraday performance, helping traders make quick decisions based on daily price movements.

Swing Traders: The MTD net change offers insights into short-term trends within the month, aiding in the identification of potential swing opportunities.

Long-Term Investors: The YTD net change allows for tracking yearly performance, which is valuable for portfolio management, performance evaluation, or tax-related purposes (e.g., assessing gains/losses in 2025).

The table's overlay format ensures that these metrics are always visible on the chart, providing a convenient reference point during technical analysis. It complements other tools like momentum indicators or moving averages, offering a comprehensive view of both price performance and trend dynamics.
Potential Enhancements:
Percentage Change: The indicator currently displays net changes in dollar terms. Adding percentage changes (e.g., YTD % change = (YTD Net Change / Year Open Price) * 100) could provide a more normalized perspective on performance.

Color Coding: Incorporating conditional formatting (e.g., green for positive net changes, red for negative) would make the table more visually intuitive for quick decision-making.

Dynamic Year Input: Allowing users to dynamically input the starting year (instead of hardcoding 2025) would enhance the indicator's flexibility for use in future years.

Additional Timeframes: Including other periods like Quarter-to-Date (QTD) could align with business reporting practices, as highlighted in related sources like Sisense (2025), which discusses the importance of QTD metrics for trend analysis.

Connection to the Original Post:
The "ItsGuarantee Instrument Net Change Real-Time" indicator connects directly to the theme of the original X post by @ItsGuarantee
about "Instrument Speed & Close Momentum." While the post likely refers to a momentum-based indicator (focusing on the rate of price changes to assess trend strength), this net change table provides a complementary perspective by quantifying price performance over specific timeframes. Momentum indicators, as noted in the Investopedia (2025) web results, are useful for identifying overbought or oversold conditions, while net change metrics (YTD, MTD, DTD) offer a straightforward way to track overall price movement, supporting trend confirmation or portfolio monitoring. The "ItsGuarantee" branding ties this indicator to the creator's suite of tools, emphasizing real-time, actionable insights for traders.

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.