OPEN-SOURCE SCRIPT

Simple Sessions

Aggiornato
This is a simple sessions indicator that allows you to highlight up to 3 different sessions on your chart. This is intended for charts in any timeframe lower than the Daily timeframe. Really simple, clean, and minimalistic on purpose, intended to help and not clutter the chart.

Options/parameters:
  • Sessions: Check and setup beginning and end of the sessions. Up to 3 sessions at the same time.
  • Enable specific timezone: You can specify your exact timezone so that the sessions stay consistent even when you’re viewing different assets from different brokers that might be providing the price data in different timezones.
  • Show next day: Check to allow for your sessions to be viewed in advance for the following day so that you can expect your trading session in the chart (something simple, but quite useful).
  • Show next day input also accepts an integer value (default at 0). This numeric value is useful only for a few different assets that don’t have price data (aren’t tradable) 24 hours of each week-day. When that’s the case the calculation to show the session in the future day is not precise so with this number you can adjust it. For example, on SPX500USD in the 30m time-frame, between 5pm and 6pm NY time there’s no price data. If you check that chart on any day at 4:30pm NY time, the next bar should be at 5pm, however since there’s no data it jumps to 6pm NY time. For that example you can set the input number to -2 and it will move the sessions to the correct time window you specified in the Sessions input. istantanea
  • Optional comment: This is a comment that will be shown in the status line. There’s no other use for this. It’s only helpful when you have multiple instances of the indicator for different assets for example. In that case with this comment you would be able to instantly detect which indicator is for which chart.
Note di rilascio
This is a simple sessions indicator that allows you to highlight up to 3 different sessions on your chart. This is intended for charts in any timeframe lower than the Daily timeframe. Really simple, clean, and minimalistic on purpose, intended to help and not clutter the chart.

Options/parameters:

  • Sessions: Check and setup beginning and end of the sessions. Up to 3 sessions at the same time.
  • Enable specific timezone: You can specify your exact timezone so that the sessions stay consistent even when you’re viewing different assets from different brokers that might be providing the price data in different timezones.
  • Show next day: Check to allow for your sessions to be viewed in advance for the following day so that you can expect your trading session in the chart (something simple, but quite useful).
  • Optional comment: This is a comment that will be shown in the status line. There’s no other use for this. It’s only helpful when you have multiple instances of the indicator for different assets for example. In that case with this comment you would be able to instantly detect which indicator is for which chart.


Notes on showing the next day's session:

In the previous version I was calculating the number of seconds in a day and dividing that by the number of seconds of the chart's timeframe to calculate how many bars there were in a day for the current asset. However this turned to be imprecise for a few different assets that don’t have price data (aren’t tradable) 24 hours of each week-day (such as the SPX500 that is missing data between 5pm and 6pm NY time). In those cases when checking 'Show next day', the script would calculate incorrectly the bars to offset and the sessions were not always on the expected hours. Which is why I had added an additional input to manually add an offset to fix the issue.



To solve this problem in a better way, with this release, I'm calculating the bars between each session every day and using that amount to offset.



This method might still be not 100% precise when there's missing price data randomly in a single day for whatever reason, but it will be fixed in the following day. I haven't experienced this issue, it's just a possibility that came to my mind. This solution is better than the previous one as it will now calculate much more precisely the bars between the sessions and offset correctly in 99% of the times to show the following day's session so you can expect it.

Small downside: the resulting value of is of `series int` instead of `simple int` so the `bgcolor()` function throws a warning in the code, but this doesn't impact the result of the script.
Chart patternssessionsessions

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?


Anche su:

Declinazione di responsabilità