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.
Release Notes: You can now choose to hide historical values.
Release Notes: Fixed the last bar bug that was displaying current day values. Very annoying.
Release Notes: Wrong graph ops
Release Notes: Ok now the graph should be right and working.
Release Notes: In Forex pairs, new data was being retrieved 1 candle before the closing of the day. Now it should be fixed.
Release Notes: 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.
Release Notes: The script is now useful on daily and weekly charts, and you can set the period so that lines are shown on the chart.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Kommentarer

I need any tutorial, please i can't make yesterday OHLC line, please help me
+5 Svara
Many thanks!
+1 Svara
my closes in the futures are false, any suggestions to fix it?
cash markets are fine
Svara
just wanna say a big thanks for putting this together. easy to use. adds great value.
Svara
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
Svara
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)
Svara
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
Svara
Can you add an option to display just yesterdays levels only - not all the preceding days.
Svara
@kjs1, Ok done
Svara
Could you add a feature to show previous day only versus historical values?
Thanks
Svara
Hem Aktie-screener Forex-screener Krypto-screener Ekonomisk kalender Om Diagramfunktioner Priser Tipsa en vän Ordningsregler Hjälpcenter Webbsidor och mäklarlösningar Widgets Diagramlösningar Lightweight Charting Library Blogg och nyheter Twitter