OPEN-SOURCE SCRIPT

FX Sessions & Killzones ET

Aktualisiert
Just another sessions indicator. Among all the many existing ones, I didn't find anything simple that would cover my needs and that would actually be correct.
New York time is forced here for plotting the stripes so you don't need to worry about the time zone currently set on your chart. The indicator will be accurate during Daylight Saving Time (which, in 2023 for example, started on Sunday, 12 March , 02:00:00 and will be in effect until Sunday, 5 November, 02:00:00).
Versionshinweise
UPDATE: Fixed the Asian Open Killzone.
Versionshinweise
Asian range added.
Versionshinweise
UPDATE: Added ICT Silver Bullet (range from 10:00 AM – 11:00 AM)
Versionshinweise
UPDATE: Added the option to add / define one custom session (not displayed by default).
Versionshinweise
When you like to be precise, as I do, you may find yourself frustrated with the level of inconsistency on this topic on the Internet.
I did my best to double check the relevant sources again, reconsile the time zones and get it right. Hence the necessaity of the update.

Release notes:
Start of Sydney session corrected.
Asian session added / split from Tokyo as they are technically not exactly the same thing.
Tokyo session corrected.
End of London (and Frankfurt) session(s) corrected.
End of New York session corrected.
London open killzone shifted backward.
London close killzone shifted forward.
New York open killzone extended backward.
Equities range (and equities closing / power hour) added for those who trade ES, NQ, etc.

Plus I have adjusted the default settings as I presume that most people would generally only want the Asian range and killzones.

Note: If you're wondering why ICT killzones generally start one hour earlier than the starts of the official FX sessions, then I guess that it's just extended to account for pre-market trading.

Here's an overview of the hours:

• Sydney Session = 5:00 PM – 2:00 AM EDT = 9:00 PM – 6:00 AM UTC
• Asian Session = 7:00 PM – 4:00 AM EDT = 11:00 PM – 08:00 AM UTC
• Tokyo Session = 8:00 PM – 5:00 AM EDT = 12:00 AM – 9:00 AM UTC
• Frankfurt Session = 2:00 AM – 11:00 PM EDT = 6:00 AM – 3:00 PM UTC
• London Session = 3:00 AM – 12:00 PM EDT = 7:00 AM – 4:00 PM UTC
• New York / North American Session = 8:00 AM – 5:00 PM EDT = 1:00 PM – 10:00 PM UTC
• ICT Asian Open Killzone = 7:00 PM – 9:00 AM EDT
• ICT Asian Range = 7:00 PM – 12:00 AM EDT
• ICT London Open Killzone = 2:00 AM – 5:00 AM EDT
• ICT London Close Killzone = 10:00 AM – 12:00 PM EDT
• ICT New York Open Killzone = 7:00 AM – 10:00 AM EDT
• Equities = 9:30 AM – 4:00 PM EDT
• Equities Closing / Power Hour = 3:00 PM – 4:00 PM EDT
Versionshinweise
Complete overhaul for better user experience.
Start and end of all sessions now fully customizable.
Numbers removed from status line, cleaned up.
Sydney weekdays corrected.
Colors now a bit more distinct for better visibility on Mobiles.
Now includes all 3 time windows for the Silver Bullet setup.
An unobtrusive message will now appear on higher time frames (starting from the 2h) that "Some of the sessions may require lower time frames to appear."
I've done this primarily for myself but hopefully it can serve others as well.
Versionshinweise
I noticed the script was not resetting to default values. Now fixed.
Versionshinweise
A couple more adjustments to the colors so that it's better visible in light mode as well.
Versionshinweise
I've added an option to set a custom session box showing the high and low of the given sesssion which can be useful for certain strategies.

And one more note: The time zone is hard set to New York which means that the start and end time of the sessions should actually be correct throughout the whole year, not just during summer / daylight saving time.
Versionshinweise
The time shift between New York and Australia is different in winter, (more specifically, the time difference between New York and Sydney is usually 15 hours during standard time and 14 hours during daylight saving time). I have now adjusted the start and end times of the Sydney and Asian sessions so they are relevant to the current Fall/Winter time. The name of the indicator still says 'Spring/Summer', because changing the title would require dragging this through TradingView dev team, but feel free to use it during winter, the time windows are now correct. Besides, they are adjustable anyway.
Also, I have merged Asian and Tokyo sessions for the sake of simplification.
More importantly, I have added the option to plot a horizontal line which will – by default – be drawn from New York midnight open, but you can adjust the time of the starting point if you so wish. (Note that the time you set in the settings must align with the open of some candle currently displayed on the chart, which means that it will not work on all time frames. Whole hours – such as the default New York midnight open – will work on the 1-hour and below, down to the 1-minute.)
In addition, I have added the option to display session / daily breaks based on New York time - those are different from the 'stock' session breaks offered by TradingView settings as the 'stock' ones are based on the exchange time zone.
Enjoy.
Versionshinweise
I hate to make it more complex, but as the article on Babypips puts it, 'dealing with Daylight Saving Time is a pain…', and I couldn't agree more. I have now added the option to adjust the start and end times of the sessions to EDT [Eastern Daylight Time].
You don't need to worry about the New York session alone or anything that's directly associated with it, as this script specifically uses the "America/New_York" timezone. This means it will adjust itself and will remain correct regardless of whether it's currently Daylight Saving Time in New York or not. However, for other sessions and countries, the shift turns out to be different depending on Standard Time vs Daylight Time.
Pine Script doesn't allow variables to be used as default values. As a workaround, I simply added one more set of default values called 'EDT Adjustment' wherever applicable. In an attempt to make it as simple as possible, I have implemented a global switch (at the very top of the settings). All you need to do is turn it on during Daylight Time [spring & summer] or turn it off during Standard Time [fall & winter]. I've set it to be on by default as we've just entered the Daylight Time period. Other than that, you don't need to worry about the start and end times as the default values are, or should already be, correct. You may notice that, for some of the sessions, the days of the week had to be adjusted as well. Again, the New York session-related settings are taken care of automatically, so you won't find that addition in those sections.
At the same time, I wanted to keep the option to customize any value however you see fit.
I acknowledge that this will, unfortunately, never be perfect, as different countries switch to Daylight Time at different times. There may be cross periods when the start and end times will not perfectly match. This is about as close to overall correctness as I could get, but I would still suggest that you do your due diligence, especially during spring and fall, if you're trading anything outside the New York session.
Again, I'm doing this primarily for myself, but if you find it useful, all the better.
Versionshinweise
Added an option to increase performance by restricting the number of bars used in calculations. Users can enable this feature by ticking the box under the 'Limit Script Calculation...' section and specifying the desired number of bars in the 'Number of Bars to Fill on Chart' input field.

Added the New York / US Lunch Hour (12:00 PM to 1:00 PM ET) as a predefined session option. Users can now easily analyze price action during this specific time period.
Versionshinweise
The start and end times of the sessions and killzones have now been corrected. In the previous version, the default values for the London session, London killzones, and Frankfurt session were incorrect. Additionally, a few more corrections were made, including the end time of the New York open killzone.

To summarize, here's an overview of the correct start and end times:

==

New York Eastern Standard Time (EST) = UTC-5

Sessions:

Sydney: 1600-0100
Tokyo / Asian: 1900-0400
Frankfurt / European: 0100-1000
London: 0200-1100
New York / US: 0800-1700

Killzones:

Tokyo / Asian Killzone: 1800-2000
London Open Killzone: 0100-0400
London Close Killzone: 0900-1100
New York / US Open Killzone: 0700-0900

==

New York Eastern Daylight Time (EDT) = UTC-4

Sessions:

Sydney: 1700-0200
Tokyo / Asian: 2000-0500
Frankfurt / European: 0200-1100
London: 0300-1200
New York / US: 0800-1700

Killzones:

Tokyo / Asian Killzone: 1900-2100
London Open Killzone: 0200-0500
London Close Killzone: 1000-1200
New York / US Open Killzone: 0700-0900

==

Notes:

The times directly related to the New York session remain the same regardless of whether New York is observing EST or EDT. This is because the session times are fixed to the local time in New York.

Frankfurt / European session typically starts and ends one hour earlier than the London session (regardless of whether daylight saving time is being observed or not).

Understanding killzones:

Open killzones are typically a 2-hour buffer window extending one hour before and one hour after the respective session open. However, for the London session, the killzone can be extended by one additional hour after the open.
The London close killzone is a 2-hour window immediately preceding the London session close, i.e., the last 2 hours of the London session.
Versionshinweise
The default days for the Sydney session (EST adjustment) have now been corrected (to 23456).
Versionshinweise
As my knowledge of Pine Script progresses, I have completely overhauled this script, rewriting it from scratch to optimize its structure, logic, and performance. Most calculations have been moved into functions to handle operations more efficiently. The most significant update is the new option to display any session as a high-low box. This feature made the separate custom session box from previous versions redundant, so it has been removed. I have also removed a couple more less common sessions for the sake of simplification. Given the overall flexibility in terms of possible customization, they seemed unnecessary to me.

Now, any session can be turned into a box showing the highest high and the lowest low reached during the given period, making the script much more flexible. Everything remains fully customizable, including the start and end times of all sessions, active days of the week, and colors. Various conditions have been addressed to ensure the script plots data correctly across multiple symbol types (forex, indices, crypto, and futures).

This turned out to be a meticulous task requiring extensive testing, as there are many intricacies to account for to ensure conditions don’t clash and results are correct regardless of the asset type the script is applied to. While it may not work 100% across all charts, my focus was on forex pairs, the dollar index, and crypto, as I am primarily a forex trader. I also made efforts to tweak it for futures, but this is particularly challenging and I don’t personally trade those, so it may not be the best use case. However, you can certainly give it a try, and I believe it should work for the most part.

Make sure to select the RTH vs. ETH in the script settings based on what you’re currently using. Additionally, it’s vital to select the correct time (EST vs. EDT) based on what is currently observed in New York, as failing to do so may result in boxes being plotted in the wrong places on the horizontal scale. Further tweaking may be needed once we switch back to EST in the fall later this year.

As a bonus, I have added an option to plot one more horizontal line representing the 'True Open' based on the Quarterly Theory.

This was quite a lot of work, but I’ll keep the script open. As is often the case with projects like this, I did this primarily for myself and my own pleasure. But it would be a shame not to share it with the community. Happy trading!
Versionshinweise
I had to revisit the code as there seemed to be a huge issue with performance after the previous overhaul. The execution was very slow because the code was performing most of the computations for all options available in the settings, regardless of whether they were actually selected by the user or not. I have now completely changed the structure and optimized the overall logic for maximum efficiency. With a little help from GPT-4 (and when I say little, I mean little, as one cannot rely on that entirely), all function calls and computations have now been encapsulated within conditional statements. This vastly eliminates all unnecessary computations, as the script will now only execute internally what's been selected by the user. It's a relatively robust piece of code, but you can feel now that it reacts much more smoothly, and the previous, annoying delay has been significantly reduced.

This is an important step towards a cleaner and more 'professional' way of handling the code's execution. Though I still consider myself a beginner in that regard, I strive to do things as correctly as possible despite my limited knowledge. With the possibilities of using AI that we have nowadays, it would be a shame not to utilize it.
Versionshinweise
An additional update was made to correct the days of the week functionality, which was previously not working. The user input was being ignored for all New York-related sessions. Now, it correctly respects the user-specified days of the week.
Versionshinweise
The previous version of the script had serious issues with colors, where some would disappear completely when the user adjusted the transparency. This issue was due to directly defining colors with inline transparency (e.g., `#c9706148`). Using this method can cause problems when multiple layers of transparency are combined or adjusted dynamically. In this update, I have corrected this by managing transparency explicitly with `color.new`, ensuring that transparency is handled correctly.
Versionshinweise
Time Zone Update: Eastern Standard Time (EST) Default Values
Session Time Corrections:

Sydney:
- Start time: Changed from 16:00 to 15:00
- End time: Changed from 1:00 to 00:00

Frankfurt:
- Start time: Changed from 1:00 to 2:00
- End time: Changed from 10:00 to 11:00

London:
- Start time: Changed from 2:00 to 3:00
- End time: Changed from 11:00 to 12:00

London Open Killzone:
- Start time: Changed from 1:00 to 2:00
- End time: Changed from 4:00 to 5:00

London Close Killzone:
- Start time: Changed from 9:00 to 10:00
- End time: Changed from 11:00 to 12:00

Eastern Daylight Time switch is now disabled by default.
Chart patternsForexfxhoursictkillzonesmidnightmultitimeframeopensentimentsessionTIME

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss