Scripts: Save OHLCV Data from Chart to CSV File

 

Save OHLCV Data from Chart to CSV File:

This script saves all the OHLCV data available on the chart to a CSV file.

Save OHLCV Data from Chart to CSV File

Author: Mohammad Sh

 
any difference than exporting in SYMBOLS menu?
 
umad #:
any difference than exporting in SYMBOLS menu?

From my experience, sometimes the Symbols menu tool doesn't return all the available data on the chart (and sometimes it doesn't work at all), specially when dealing with data-providers other than MetaQuotes. I guess this is because the Symbols menu tool requests the data from the broker, and brokers impose limitations on the number of bars we can get in one request (I guess that's why historical data is filled gradually when we open a completely new chart).

This script saves the data that are available locally on the chart, so such limitations don't apply to it.

 

Hi, tks for sharing.
But is it still working ? I have tried on multiple charts brokerages and terminal.
Get the successful saved excel file message, but unable to find in which folder it managed to do the download.

Tried searching everywhere.

 
ralph4t #:

Hi, tks for sharing.
But is it still working ? I have tried on multiple charts brokerages and terminal.
Get the successful saved excel file message, but unable to find in which folder it managed to do the download.

Tried searching everywhere.

Hi, you're welcome.
Please open the MetaEditor (the yellow-icon program that comes with MetaTrader), then go to "File>Open Common Data Folder". A folder opens up. Open "Files" folder. You can find the output there.

 
Mohammad Sh #:

Hi, you're welcome.
Please open the MetaEditor (the yellow-icon program that comes with MetaTrader), then go to "File>Open Common Data Folder". A folder opens up. Open "Files" folder. You can find the output there.

Hi again,
tks very much mate, worked perfectly!
if u'd like a python code that turns the excel into a well organized data sheet within columns and not separated with spaces hit me up ralphzayl4t@gmail.com I worked on one.
while for u how do u do it to work with the data ?
 
ralph4t #:
Hi again,
tks very much mate, worked perfectly!
if u'd like a python code that turns the excel into a well organized data sheet within columns and not separated with spaces hit me up ralphzayl4t@gmail.com I worked on one.
while for u how do u do it to work with the data ?

Thanks for sharing the python insight, I will contact you if I need that functionality.
I primarily import the OHLCV data back to MetaTrader to use it in the Strategy Tester. In some cases I want to make sure I have the data in my pc even if my demo account expires. In some cases, I change spread, broker limitations, etc., to test the strategy with my own preferred specifications. The output csv is formatted in a way that it can be imported back to MetaTrader directly, but it can also be imported to python, etc.