This ProBuilder script is designed to display historical data for each trading day starting from a specified date until the current day. It uses text overlays to export data directly on the chart, which can be useful for visual analysis or for preparing data for optical character recognition (OCR) processes.
defparam drawonlastbaronly=true
startDate = 20190101
once plotted=0
if date=startDate then
startbar=barindex
endif
if date=today and not plotted then
for i = 0 to barindex-startbar do
iday=day[i]
imonth=month[i]
iyear=year[i]
iopen=open[i]
ihigh=high[i]
ilow=low[i]
iclose=close[i]
y=i*0.1
drawtext("#iyear#.#imonth#.#iday#;#iopen#;#ihigh#;#ilow#;#iclose#",barindex,y,dialog,standard,12)
next
plotted=1
endif
return
Explanation of the code:
drawonlastbaronly=true to ensure that drawing commands are executed only on the last bar of the chart. This improves performance by not redrawing on every bar.startDate is defined with a specific date from which the data export will begin.startDate. If true, it records the bar index at this date in startbar.plotted=0), the script enters a loop from the start bar to the current bar.day[i].drawtext to display the extracted data on the chart. The y-coordinate is slightly adjusted by i*0.1 to prevent overlapping of text.plotted is set to 1 to prevent re-plotting the same data.This script is particularly useful for visually exporting data from a trading chart, which can then be captured and processed externally, such as through OCR technologies.
Check out this related content for more information:
https://www.prorealcode.com/topic/how-to-extract-every-candles-data/#post-96205
Visit Link