I only have 1 chart open GBPUSD H1 when I run the code below, but the value I get for the closing price does not match the chart. The output file (attached) gives me '2018.01.30 11:00|1.41090000' but the closing price for that 2018-1-30 11:00 is 1.41258 and not 1.4109
You had to run the script when the price was 1.4109 then the price rose and closed at 1.41258
Your problem is as I mentioned in your another topic yesterday: https://www.mql5.com/en/forum/226189#comment_6444398 that you don't use ArraySetAsSeries(). You should read at least your topics.
Your script might look like this:
void OnStart() { string line; datetime date_buff[]; ArraySetAsSeries(date_buff,true); int copied=CopyTime(NULL,PERIOD_H1,0,2,date_buff); int file_handle=FileOpen("h1.csv",FILE_READ|FILE_WRITE|FILE_CSV); line=TimeToString(date_buff[1])+"|"+DoubleToString(iClose(NULL,PERIOD_H1,1)); FileWrite(file_handle,line); FileClose(file_handle); }

- 2018.01.30
- www.mql5.com
You had to run the script when the price was 1.4109 then the price rose and closed at 1.41258
Your problem is as I mentioned in your another topic yesterday: https://www.mql5.com/en/forum/226189#comment_6444398 that you don't use ArraySetAsSeries(). You should read at least your topics.
Your script might look like this:
My bad I didn't realize you had already given me my answer. Thank you

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I only have 1 chart open GBPUSD H1 when I run the code below, but the value I get for the closing price does not match the chart. The output file (attached) gives me '2018.01.30 11:00|1.41090000' but the closing price for that 2018-1-30 11:00 is 1.41258 and not 1.4109