Yearly Quarterly Monthly Weekly Daily H4 H1 OHLC Lines

Yearly Quarterly Monthly Weekly Daily H4 H1 OHLC Lines

This indicator displays yearly, quarterly, monthly, weekly, daily, 4 hourly and 1 hourly OHLC (open, high, low and close) values on a price chart.

You can choose which OHLC values you want to display and also display just the high and low values or just the open and close values or all of them.

By changing the LookBack period you can display the OHLC values from any previous year, month week etc. When LookBack = 1 it displays on each candle values from the previous year, previous month, previous week etc. When LookBack = 2 it displays the values from two years ago, two months ago etc. With this feature if you add the indicator multiple times to your price chart you can for example display lines representing the last three months OHLC values.

The daily values are calculated starting at the open of the Monday candle to remove the issue of having Sunday OHLC values throughout Monday. You actually get the OHLC of Friday and Sunday combined shown on a Monday. The weekly values are calculated from the opening of the Sunday candle. If there is no Sunday or Monday candles then the week OHLC starts on whichever is the first trading day of that week.

The indicator can be used on any time frame chart but you have to have enough candles on a chart to display the values. The indicator has to be able to see a complete previous year from Jan 1st to Dec 31st before it can display any OHLC values for a year. The same for a month – it needs a whole month before it can display anything. Same for a week etc. It is not possible to display faster time frame OHLC values on a slower time frame chart. So you can’t have daily OHLC on a weekly chart for example.

It can be slow to draw if you want everything displayed on a lot of bars!

I suggest downloading the ITF file and importing it rather than cutting and pasting to ensure that you get full functionality.

Code written following the request made here: https://www.prorealcode.com/topic/conversion-tradingview-to-prorealtime-previous-ohlc/

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. vetrader • 04/08/2019 #

    Looks great. Thank you very much. I will test it during the next days!

  2. Vonasi • 04/08/2019 #

    Please note that there is a small bug in the indicator caused by a typo. Please delete ‘and openday[1] 7’ on line 75 (I’m not sure how it got there except for a cut and paste error!) Hopefully Nicolas will update the library post soon to remove this.

  3. vetrader • 04/08/2019 #

    Everything seems to work very well. But I would still recommend to pre-check everything if you change the timeframe in your chart. This is the best and most reliable code for previous OHLC….Thanks again!

  4. Vonasi • 04/08/2019 #

    The typo on line 75 has now been corrected in this library post and a new v1.1 ITF file attached. Thanks for doing that Nicolas.

  5. Balmora74 • 04/08/2019 #

    Thanks for this code but there is 4 different versions and i don’t know wich is the good one ?

  6. Vonasi • 04/08/2019 #

    I don’t understand. There is only one ITF file here not four. Download and import it. You might want to change line 75 to if opendayofweek opendayofweek[1] and opendayofweek 0 then as this means that small range Sunday bars are included in with Friday bars as per the description.

  7. Balmora74 • 04/08/2019 #

    Ok i understand now… I make a confusion with a other code… Thanks Vonasi.

  8. thierrybl • 04/08/2019 #

    Hi Vonasi,

    I thank you for your great indicator i’m using every day !
    I tried to add a fonctionnality, but with no success.

    My idea is to add a floating line (blue dotted) on the graph which indicates the next level prices are going to cross (daily, weekly, monthly,etc …)
    For exemple, on the graph, under the actual price, the blue line indicate the next level prices will meet, that is the high of May 4th.

    If prices crosses that level, the blue line disepears and is set on the 2sd level crossed, then on the 3rd, etc …

    That way, I just have one blue line above and one blus line below price.

    I hope I have been clear.

    Thanks a lot for your help

    Thierry

  9. thierrybl • 04/08/2019 #

    I can’t post an image. i don’t know how to do. Sorry

  10. thierrybl • 04/08/2019 #

    Lien vers mon image

  11. thierrybl • 04/08/2019 #

    [URL=https://www.casimages.com/i/200515043914185668.jpg.html][IMG]https://nsa40.casimages.com/img/2020/05/15/mini_200515043914185668.jpg[/IMG][/url]

  12. Vonasi • 04/08/2019 #

    That should be possible – I’ll add it to my list to work on!

  13. thierrybl • 04/08/2019 #

    Thanks a lot

  14. B-ling1 • 04/08/2019 #

    Hi Vonasi, I love this indicator – good job! Just one question: If I want the monthly OHLC Lines in the daily timeframe, its (most of the time) 1 day to late, to switch the month. Example: It takes the dayclose from the Sept 01 as August monthly close instead the close from Aug 31th… what can I do, to avoid this error? Thanks in advance for your support! Cheers

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+5 more likes

Related users ' posts
s00071609 I am using this indicator but it keep crashing as i change the timeframe. For example, chang...
Nicolas in the mean time you can try this one: https://www.prorealcode.com/prorealtime-indicators/ho...
Gianluca Is it possible to have an indicator where those value are as instogram ? and separated? in o...
rb-72 Thank you, area of twist by dilatacion of the price, missing part of the code that is not pu...
Thomas007 after reading your blog now I understand why there is only a part of your code here. I'm try...
Juanjo Hola¡¡ la estrategia se podria aplicar sobre acciones con marco temporal diario?? gracias.
Leo Hi all, I posted a new version of this indicator ( I just add arrows to spot the local maxi...
Trading_En_El_Ibex35 Muchas Gracias por compartir este interesante indicador. Un saludo
xavieralava hola gracias leo
Nicolas https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291
Manu L. Bonjour Nicolas, suite a une de mes precedentes demande dans le forum indicateur, j'ai touv...
AntoGH C'est selon moi le meilleur indicateur, que j'ai vu, si vous trouvez mieux dîtes moi car dif...
Wing Not yet but I plan to.
Leo Have a look in this Forum, I got something interesting for you... https://www.prorealcode.co...
Dávid Gyalus Dear Wing, As I am a daytrader, and one of my best friend is a programmer we think your a...
haseluis Hello, who can help me why the screener does not work // Der folgende Code bezieht sich auf...
Nicolas Hello, please ask your question with a new forum topic, this is not the place to ask for sup...
Nicolas Questo indicatore è stato progettato solo per i dati intraday, ma potrebbe essere adattato a...
MrCrous //FR Bonjour, Dans le code ci dessus, je ne comprends pas ce que fait la ligne : linea...
Nicolas J'ai déjà répondu à cette question quelque part sur le forum. Il faudrait chercher un topic ...
julien1978 The ADR value that is plotted intraday does not match the value of the regular ATR indicator...
Fab666 I've tried to get a fix for this also but no luck, it doesn't print the correct data as far ...
Seabiscuit Hi! With the new PRT update, this indicator does not work anymore
Wing Yes, investigate as much as you want. For more insight, you can view the linet1, linet2 etc....
CKW Hi Wing, Thanks for your sharing. I am still trying to breakdown & understand your code...
Wing Hello CKW. No, the parameter, 7 in this case, is used when calling the RSI indicator to ide...
Nicolas Thanks for contributing to the "ichimoku section" of the prorealtime code library Don't he...
sourberry Thank you , this is a great indicator works beautifully. Could you kindly modify to scr...
pp_playaflamenca Excuse me,... reading your code about spanB: [ SenkouSpanBFutureW = (Highest[SenkouSpanPerio...
Doctrading Yes, nice idea.
noisette I tried some backtests with "9:30 MACD" with "Breakout strategy" but results are much better...
Doctrading Hello, can you send us your code ?
Doctrading Thanks, man !
rajiwas How is it possible to add currentWeekHigh and currentWeekLow, currentWeekOpen and currentWee...
Takeshi Totally don't match the PRT basic pivots on weekly

Top