I want to save the data {time,Open,Low,Close}, each item individuialy in a binary file, I have this code:
#include <stdlib.mqh>int handle_low, handle_high, handle_close, handle_open, handle_time;
bool once;
int init(){
handle_time=FileOpen("time_h1.bin", FILE_BIN|FILE_WRITE|FILE_READ);
if(handle_time<1)
Comment("File could not be opened");
handle_open=FileOpen("open_h1.bin", FILE_BIN|FILE_WRITE|FILE_READ);
if(handle_open<1)
Comment("File could not be opened");
handle_high=FileOpen("high_h1.bin", FILE_BIN|FILE_WRITE|FILE_READ);
if(handle_high<1)
Comment("File could not be opened");
handle_low=FileOpen("low_h1.bin", FILE_BIN|FILE_WRITE|FILE_READ);
if(handle_low<1)
Comment("File could not be opened");
handle_close=FileOpen("close_h1.bin", FILE_BIN|FILE_WRITE|FILE_READ);
if(handle_close<1)
Comment("File could not be opened");
once = true;
return(0);
}
int deinit(){
return(0);
}
int start(){
int i;
for(i=Bars-1;i>0 && once;i--){
FileWriteInteger(handle_time,Time[i],SHORT_VALUE);
FileWriteDouble(handle_open,Open[i],DOUBLE_VALUE);
FileWriteDouble(handle_high,High[i],DOUBLE_VALUE);
FileWriteDouble(handle_low,Low[i],DOUBLE_VALUE);
FileWriteDouble(handle_close,Close[i],DOUBLE_VALUE);
}
Print(Bars," done");
once =false;
return (0);
}
question 1: I dont think that FileWriteInteger is writing it corrent, do you see any problem?
question 2: do you have a function that I could use to select only data from the London and NY sections? like:
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi Guys,
I want to save the data {time,Open,Low,Close}, each item individuialy in a binary file, I have this code:
question 1: I dont think that FileWriteInteger is writing it corrent, do you see any problem?
question 2: do you have a function that I could use to select only data from the London and NY sections? like:
bests regards!