TradingView
Koalems
23 jan 2022 05:13

Fusion: Forex sessions with daylight savings 

Bitcoin / U.S. dollarBitstamp

Beskrivning

This has multiple ways to see Forex sessions as I found both on the main chart and on a separate chart useful at different times so this gives you the benefit of both.

When you want to use this separate from your main chart uncheck it the option "On main chart".

On the main chart we can show:
  • The legend
  • Boxes
  • Labels
  • Breakout check area
  • Start & end labels


On any other chart area we can show:
  • The legend
  • Horizontal bars representing the sessions.


All objects are color coded and the legend shows the color codes.

Credit:
Blended my own sessions indicator and "FX Market Sessions" by boidoki

The code is structured to easily drop into a bigger system so use it as a lone indicator or add the code to some bigger project you are creating.

Finally, if you find value please do make a comment, give thumbs up etc.

Enjoy and good luck!

Versionsinformation

Just a code formatting fix.

Versionsinformation

Grammar fix.
Kommentarer
kelvin29
Does it update annually automatically???
Koalems
@kelvin29, Yeah, if you look at the note on lines 85-87 you will see that I chose to use an internal function that automatically follows daylight savings and other such things that change in different regions. Of course there's always a chance that the source doesn't update correctly but that's out of my control. I should mention that the input of "From" and "To" times are manual inputs but they should change almost never so shouldn't be a bother.
per-aspera-ad-astra
Hi, is there a way to make this script work on time frames lower than 1 minute?
Koalems
@per-aspera-ad-astra, I hadn't tried it on that low of a timeframe. In principle it should work on all timeframes below a day however I have had funky things happen occasionally with drawing intensive scripts so if you are finding it not working the only thing I can suggest is keep an eye on pine script updates and if you see a major update try it again and maybe it will work. Also, try the off the main option as that's less drawing intensive and might have a better chance of working.
per-aspera-ad-astra
I see 'Pine cannot determine the referencing length of a series. Try using max_bars_back' error
M1 chart

M3 and above work...
Koalems
@per-aspera-ad-astra, ah, disregard what I said in the above comment, I didn't know it was having a problem because of a bug. I'll look at this shortly, with any luck it will be as easy as the message says.
ryefex
awesome script man. thanks a lot
Koalems
@ryefex, Thank you!
Zeta08
awesome script
Koalems
@Zeta08, , Thank you!
Mer