OPEN-SOURCE SCRIPT

New day started with DST

New Day Started with DST Indicator

Description:
The "New Day Started with DST" indicator is designed for intraday charts and highlights the first bar of each new trading day, accounting for Germany's timezone and daylight saving time (DST) adjustments. This is particularly useful for traders who follow the German market or need precise day start indications based on Central European Time (CET) and Central European Summer Time (CEST).

Features:
- Timezone Adjustment: Automatically adjusts the time to CET (UTC+1) during standard time and CEST (UTC+2) during daylight saving time.
- Daylight Saving Time (DST) Handling: Correctly identifies the start and end of DST based on the last Sunday in March and October.
- New Day Highlight: Highlights the first bar of each new day, allowing traders to easily identify the start of a new trading day.

How It Works:
- Timezone Calculation: The script calculates the current time in Germany by adding the appropriate timezone offset to the UTC time.
- DST Rules: The script manually checks the conditions to determine if the current date falls within the DST period.
- New Day Detection: By checking the hour and minute of the corrected German time, the script determines if a new day has started and highlights the first bar accordingly.

Benefits:
- Enhanced Accuracy: Ensures that the start of a new day is accurately reflected according to German trading hours, considering both CET and CEST.
- Visual Aid: Provides a clear visual indication of the start of a new trading day, improving chart readability and trading precision.
- Customizable: Can be easily modified to adjust for other timezones and DST rules if needed.

Usage:
Apply this indicator to your intraday charts to automatically highlight the first bar of each new trading day, taking into account the timezone and DST adjustments for Germany. This tool is essential for traders operating in or tracking the German market, offering a reliable and precise method to monitor daily trading activity.

Example:
![New Day Highlight Example](URL-to-your-screenshot)

This indicator ensures that you never miss the start of a new trading day, helping you to make timely and informed trading decisions.

---

How the Script Works:

1. Timezone Offset Calculation:
- The script begins by setting the base offset to 1 hour (CET is UTC+1).
- It initializes the DST offset to 0.

2. Determining the Current Month and Day:
- It retrieves the current month and day of the month from the `time` variable.

3. Checking DST Conditions:
- For months between April and September (inclusive), the DST offset is set to 1 hour (CEST is UTC+2).
- For March, it checks if the current date is after the last Sunday of March and if the time is past 2:00 AM to determine if DST should start.
- For October, it checks if the current date is before the last Sunday of October and if the time is before 2:00 AM to determine if DST should end.

4. Adjusting the Time for Germany:
- The script calculates the corrected German time by adding the base offset and DST offset to the UTC time.

5. Detecting the Start of a New Day:
- It checks if the hour and minute of the corrected German time are both zero (00:00), indicating the start of a new day.

6. Highlighting the First Bar:
- If the script detects a new day, it highlights the first bar of the new day with a green background color.

This approach ensures that the script accurately reflects the start of a new trading day according to German trading hours, including adjustments for daylight saving time.
Cycles

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?

Wyłączenie odpowiedzialności