Scripts: periodgen

 

periodgen:

Quckly generate histoircal data from any M1 data such as alpari for all time frames up to D1. Shift Time to suit your server.

Author: Iggy

 
Thanks. This is great! Will save me a lot of time. Thanks again.

Hendrick
 
Hello,
May I alter your script to get a range of data based on the 2 dates?

In your script: http://codebase.mql4.com/en/code/11173

where should I insert this "if" test to cut data (generated by periodgen. mq4)
- before the starting date dateStart
and
- after the ending date dateEnd

Which datetime's variable should be used in my IF test ?

datetime dateS=D'2005.03.01 00:00:00';
datetime dateE=D'2007.03.01 00:00:00';
// d is the date recorded in the files /databank/XXXXXXYY.hst
if (dateStart<=d && d<dateEnd) {
    ... (part of periodgen.mq4 script filling the the files)
}


Thanks a lot.
 
budhax:
Hello,
May I alter your script to get a range of data based on the 2 dates?

In your script: http://codebase.mql4.com/en/code/11173

where should I insert this "if" test to cut data (generated by periodgen. mq4)
- before the starting date dateStart
and
- after the ending date dateEnd

Which datetime's variable should be used in my IF test ?

I guess you can try it right where the write is

datetime dateS=D'2005.03.01 00:00:00';
datetime dateE=D'2007.03.01 00:00:00';
// d is the date recorded in the files /databank/XXXXXXYY.hst
if(newtime != pTime[i] || isEndOfFile) { if (dateStart<=d && d<dateEnd) {
    ... (part of periodgen.mq4 script filling the the files)
FileWriteInteger(pFile[i], pTime[i]); FileWriteDouble(pFile[i], pOpen[i]); FileWriteDouble(pFile[i], pLow[i]); FileWriteDouble(pFile[i], pHigh[i]); FileWriteDouble(pFile[i], pClose[i]); FileWriteDouble(pFile[i], pVolume[i]);
rest of the code }
}

But why would you want to do that.

When backtesting you can always select a range of dates there.
When loading into history thru tools/history you can always select a range of records to load.

I wouldn't vouch for the code above as I've never tested it.