TradingView
Plumptoiletduck
28 feb 2020 15:02

Custom Time ranges. Daily price ranges. 

Descrizione

Addition to previous time range script, now containing daily ranges. You can select a day of the week, and have it show the high, low, mid, and open of that day.


For the time bands:


Monday = 2
Tuesday = 3
Wednesday = 4
Thursday = 5
Friday = 6
Saturday = 7
Sunday = 1


Example 1:

1500-1800:2

This will colour the background between 3pm and 6pm on Mondays.


Example 2:


0000-0600:247

This will colour the background between midnight and 6am on Mondays, Wednesdays, and Saturdays.



For the Daily price ranges:

Just select the tick-box forthe day, and then the price levels you'd like to see.



I want to add specific weekly levels to this, for example: week 06 of year 2020, but I've not figured out how to do it yet. If anyone knows, I'd appreciate it if you let me know. I'll then update this script.

As always, any questions you may have, please leave in comments below and I'll respond when I have time.

If you notice anything good with this indicator, let me know. We are all in this to make money after all! ;)
Commenti
ksha3yaa89948
What time zone is this highlighting ? I have my TV on UTC+2, but when I set Session 1 0000-1300:1, the highlighted area is off by 5hrs
Plumptoiletduck
@ksha3yaa89948, It is likely the exchange data using a different time zone, what pair and exchange are you seeing the difference? If you check Bybit BTCUSD for example, it works just fine.
arunv
Hi, Thank you so much! I come across this script and which is very close to my requirement. However, I would like to see a horizontal line for high & low of first candle for the week and these lines need to be extended for the full week. Would you help add a small piece of code to add this change? The work is really awesome and superb! thx much in advance!
acapovilla
Thanks for sharing. Im looking a way to set the lines to hold the highs and lows made at the first 30 minutes of the market through all the day. Example:

S&P500 opens at 3100, within the first 30 minutes the highest price is 3120 and the lowest is 3080. How can you set those levels thorought the rest of the day?

Thanks for sharing
bemanojb
I just came across this script. Thank you for this script. I'm new to Pine programming and this script is really interesting and it helps me to identify the daily levels in a simple way.
As I said I'm new to Pine programming and I've tried my level best and failed miserably to find a way to display the daily price levels in text along with the lines. Is it possible to update this code to include the price levels in text also. Thank you once again for this script.
Plumptoiletduck
@bemanojb, You're welcome.

When you say "display price levels in text", do you mean show the price value as text? For example if the daily open value is $9001.45 it would show that value next to the level?
bemanojb
@Plumptoiletduck, Thank you for your prompt response. Really appreciate...
Yes. The price levels in text also along with levels (lines) for day high, low, open and mid.
Plumptoiletduck
@bemanojb, I think that is possible, but only in V4 pinescript. I actually had a go at converting it a while ago but it drove me nuts trying to get it to work since it would break other parts of the script (I failed). If I get time I'll hve another crack at it.

In the meantime you have two options:

1. Right click on price scale > Labels > indicator last value (this will show the last values for the daily levels on the price axis).


2. click on 'data window' (below alerts on the right hand side menu). Then hover over the daily levels, it will give all the values.
bemanojb
@Plumptoiletduck, Thank you for your prompt feedback. Will try this. Thank you once again for your support.
tranquiltrade
Thanks a lot for the script. If I want to change the open price to a particular time , say 09:15AM, how to change the script? Is this the one to change? "openPrice = security(tickerid, 'D', open)". Many thanks
Altro