Download MetaTrader 5

Scripts: periodgen

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
182438
MetaQuotes Software Corp. 2006.12.06 15:17 

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

Hendrick Stam
17
Hendrick Stam 2006.12.15 10:33  
Thanks. This is great! Will save me a lot of time. Thanks again.

Hendrick
MQL4 Comments
16319
MQL4 Comments 2007.04.14 03:35  
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.
Iggy
478
Iggy 2007.04.14 05:00  
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.


To add comments, please log in or register