How to import daily bars into MT5

 

Hi there,

I've followed these instructions on importing data:

https://www.backtestmarket.com/en/blog/post/how-to-load-data-in-mt5.

The MT5 user guide also has instructions on importing data but both resources related to 1M bars.  I'm interested in daily bars for coffee for 10 years which I can get from yahoo finance as below..


Date,Open,High,Low,Close,Adj Close,Volume

2012-01-03,226.850006,228.000000,222.399994,227.199997,227.199997,10692

2012-01-04,226.000000,229.149994,224.399994,226.699997,226.699997,10663

2012-01-05,225.449997,225.800003,217.550003,219.550003,219.550003,15059

2012-01-06,219.000000,222.399994,216.600006,221.750000,221.750000,9980

2012-01-09,220.750000,224.500000,217.600006,221.850006,221.850006,9768

2012-01-10,221.500000,226.100006,221.149994,225.949997,225.949997,9694

2012-01-11,225.250000,235.199997,224.149994,234.899994,234.899994,20865

2012-01-12,233.800003,238.500000,231.850006,233.899994,233.899994,13689


That isn't the format desired by MT5 which seems to only accept M1 bars.

Is there a way for me to import D1 data?

Advice much appreciated.

 
brettles: I've followed these instructions on importing data: https://www.backtestmarket.com/en/blog/post/how-to-load-data-in-mt5

The MT5 user guide also has instructions on importing data but both resources related to 1M bars.  I'm interested in daily bars for coffee for 10 years which I can get from yahoo finance as below..

That isn't the format desired by MT5 which seems to only accept M1 bars. Is there a way for me to import D1 data?

Advice much appreciated.

The reason it wants M1 data is that it can then build all the other higher timeframes.

However, if you don't have M1 and only D1 data, then import the D1 as if it were M1 data. In other words there will be only one M1 bar per day. Metatrader will then build the other time-frames (incorrectly obviously), but the D1 and above will be correct.

Just make sure to properly reformat your import data to be compatible with reading M1 data.

PS! Your linked reference gives a 404 error, because there is an extra "." in the URL.

 
Fernando Carreiro #:

The reason it wants M1 data is that it can then build all the other higher timeframes.

However, if you don't have M1 and only D1 data, then import the D1 as if it were M1 data. In other words there will be only one M1 bar per day. Metatrader will then build the other time-frames (incorrectly obviously), but the D1 and above will be correct.

Just make sure to reformat your import data to be compatible with reading M1 data (that means a date and a time).

PS! Your linked reference gives a 404 error, because there is an extra "." in the URL.

Thanks!
 

I tried reformating the bars as 1 min bars as below:

DATE,TIME,OPEN,HIGH,LOW,CLOSE,TICKVOL,VOL,SPREAD

2012-01-03,00:01:00,226.850006,228,222.399994,227.199997,4,10692,0

2012-01-03,00:02:00,226,229.149994,224.399994,226.699997,4,10663,0

2012-01-03,00:03:00,225.449997,225.800003,217.550003,219.550003,4,15059,0


The data begins at 2012-01-03 00:01:00

and ends as  2012-01-04 17:59:00.


I obtained the data from https://au.finance.yahoo.com/quote/KC%3DF/history?p=KC%3DF.


I loaded the data as below:


and then running strategy tester on the data as below:


I got the below error:

That says "Coffee.a: no history data from 1970.01.01 00:00 to 2022:03:21 00:00".


Any assistance to move forward appreciated.

Coffee May 22 (KC=F) stock historical prices & data – Yahoo Finance
Coffee May 22 (KC=F) stock historical prices & data – Yahoo Finance
  • au.finance.yahoo.com
Discover historical prices for KC=F stock on Yahoo Finance. View daily, weekly or monthly formats back to when Coffee May 22 stock was issued.
 
brettles #: I tried reformating the bars as 1 min bars as below:

DATE,TIME,OPEN,HIGH,LOW,CLOSE,TICKVOL,VOL,SPREAD

2012-01-03,00:01:00,226.850006,228,222.399994,227.199997,4,10692,0

2012-01-03,00:02:00,226,229.149994,224.399994,226.699997,4,10663,0

2012-01-03,00:03:00,225.449997,225.800003,217.550003,219.550003,4,15059,0

Didn't you say you only had daily data? Why are you making into into into minute data?

That is not what I recommended you do. I stated the you should read it as minute data but still keep as daily data so that it would read it as one M1 bar per day.

DATE,TIME,OPEN,HIGH,LOW,CLOSE,TICKVOL,VOLUME,SPREAD
2012-01-03,00:00:00,226.850006,228.000000,222.399994,227.199997,4,10692,0
2012-01-04,00:00:00,226.000000,229.149994,224.399994,226.699997,4,10663,0
2012-01-05,00:00:00,225.449997,225.800003,217.550003,219.550003,4,15059,0
 
Also, why import? Just find a broker that offers that symbol on the MT5 platform and use the demo accounts.
 
It's for coffee futures and I don't think I can find a broker with more than a few months of data for that, but I will check.
 
Ok so I went to a differnt broker and immediatley found a cash contract that goes back 5 years.  Thanks again.
 
brettles #: Ok so I went to a differnt broker and immediatley found a cash contract that goes back 5 years.  Thanks again.
You are welcome!
Reason: