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.
hello,
below is a script, and can anyone help convert this to indicator? thanks
// Output OHLCV history for surrent pair/symbol
int start() {
string fname = Symbol() + "," + Period() + ".csv";
int handle = FileOpen(fname, FILE_CSV|FILE_WRITE, ",");
if (handle>0) {
for(int i=0; i<Bars; i++) {
datetime d = Time;
d = StrToTime((TimeYear(d) - 100) + StringSubstr(TimeToStr(d),4)); // subtracts 10 years from d
string date1 = TimeToStr(d,TIME_DATE);
date1 = StringSubstr(date1,5,2) + "-" + StringSubstr(date1,8,2) + "-" + StringSubstr(date1,0,4);
string time1 = TimeToStr(d,TIME_MINUTES);
FileWrite(handle, date1, time1, Open, High, Low, Close, Volume);
}
FileClose(handle);
MessageBox("History output complete\nto file ...../experts/files/"+fname);
}
return(0);
}