EduardoMattje

Yesterday's open, high, low and close

A very simple script to plot the yesterday's OHLC, to be used in an intraday graph.

There were other scripts like this, but their code was ugly, filthy, smelly, and WET, so I did this.
Note di rilascio: You can now choose to hide historical values.
Note di rilascio: Fixed the last bar bug that was displaying current day values. Very annoying.
Note di rilascio: Wrong graph ops
Note di rilascio: Ok now the graph should be right and working.
Note di rilascio: In Forex pairs, new data was being retrieved 1 candle before the closing of the day. Now it should be fixed.
Note di rilascio: Now you can select which timeframe do you want to pull the data from, so you choose to plot the last week OHLC, or the last month.
Note di rilascio: The script is now useful on daily and weekly charts, and you can set the period so that lines are shown on the chart.
Note di rilascio: I changed the default style of the lines to be the regular lines instead of the step lines, so now, if you have selected the display current values options, the lines should be visible even at the start of the day.
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?

Commenti

I need any tutorial, please i can't make yesterday OHLC line, please help me
+7 Rispondi
Many thanks!
+2 Rispondi
my closes in the futures are false, any suggestions to fix it?
cash markets are fine
+1 Rispondi
just wanna say a big thanks for putting this together. easy to use. adds great value.
Rispondi
can we get prior day data without using security()? as lookahead=barmerge.lookahead_on is not working for me.... i am on hourly chart, and simply need yesterday's OHLC. Currently i am using security() but its leading to delayed alerts due to repainting... many thanks for your help
Rispondi
EduardoMattje vivaan-jiya
@vivaan-jiya, as far as I know using security() is the only way to retrieve the values of other timeframes. If you are getting issues what you can do is use something as

security(syminfo.tickerid, "D", open)

instead of

security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on)

I used this last method in the script because at midnight the first method still was displaying the older values, while the second method was correctly updating it. Try changing the OHLC variables to this:

yesterdayOpen = security(syminfo.tickerid, "D", open)
yesterdayHigh = security(syminfo.tickerid, "D", high)
yesterdayLow = security(syminfo.tickerid, "D", low)
yesterdayClose = security(syminfo.tickerid, "D", close)
Rispondi
can we get prior day data without using security()? as lookahead=barmerge.lookahead_on is not working for me.... i am on hourly chart, and simply need yesterday's OHLC. Currently i am using security() but its leading to delayed alerts due to repainting... many thanks for your help
Rispondi
Can you add an option to display just yesterdays levels only - not all the preceding days.
Rispondi
@kjs1, Ok done
Rispondi
Could you add a feature to show previous day only versus historical values?
Thanks
Rispondi