TradingView
vitelot
4 wrz 2019 20:19

Time ranges 

GBP/USDOANDA

Opis

This script visualizes the different time sessions during the day.
The time ranges are set to the default Frankfurt, London, NY, Sydney and Tokyo, but can be
freely modified and turned off (I personally use to display only Tokyo and NY).
If you are a day trader, e.g. you trade with the Market Makers, this tool is a "must have".
It also displays the day of the week, which can be set off as well.

vitelot/yanez/Vts Sept 2019


PS I chose this script to belong to the "volatility" category since it can be used to highlight the Asian session,
and there was no suitable category available.
Komentarze
FMLTrader
Thank you for this script, its helpfull..
vitelot
@francisco1982, you're welcome :)
Danny42
Thanks very much for this Yanez
I have hacked this to add my own time zones etc.
Luckily your code is easy to read (unlike that from others).

The day name display is not working for me at all. The menu is there to turn it on / off and all that. But it never displays.
Have you any idea why that might be? Is that functionality definitely still working?

Let me know

Thanks

Dan
vitelot
@Danny42, thanks for the appreciation.

The day name displays only on timeframes up to 4H.
You need to rework the script to be able to display it up to the daily. But then the code gets weird...
Does this answer your Q?
Danny42
@vitelot, Hi, yes thanks very much for that info. Seems like the day name of the script only occurs on the 1 hour chart. But with that information I was able to adapt your script again and get exactly what I wanted (which was simply to highlight weekends - and have it on the 4 Hr chart).

Many thanks!

Here is what I got:


It would be nice for the shape text to be a little smaller I guess, maybe I'll figure that out at some stage ;0)

cheers!

Dan
Danny42
@Danny42, I shorted the labels for day names so they fit better on the chart and changed the label offset too so they are centred inside the shaded area.



Only issues I have is with the transparency set for the shaded area set by the script (is always at 1%, I don't know why).

But otherwise am happy with the result.

cheers!

Dan
Danny42
@Danny42, The only bug / issue with my version of your script is that I am not able via the script to have the code set different color transparencies depending if current area in the specified session or not. So you can see the following:

// Determine the chart's background colour for the current day / time
chartColour = BarInSession(weekendSession) ? monToFriColour : weekendColour // this works

// Determine the chart's background color transparency for the current day / time
chartColourTransparency = BarInSession(weekendSession) ? monToFriColourTransparency : weekendColourTransparency // probably works too, but bgcolour function will not accept it

bgcolor(color=chartColour, transp=91, title="Weekend session")
// the above line of code works, but I have no idea why the following line of code does not work:
//bgcolor(color=chartColour, transp=chartColourTransparency, title="Weekend session")

I guess that the bgcolour() function just will not allow the transp property to be set in this way. But if you know of how I could fix this or can see what I have done wrong here then please let me know. Basically, yes my code is colouring the background of weekdays as blue, and weekends as red. But it is not allowing me via the code to set different transparencies for those two colours.

Thanks!
RandyMcMillan
cool...thanks!
Więcej