This commit is contained in:
Matt Corcoran
2024-10-31 18:37:26 +01:00
parent 8e1e8a4464
commit 55053f53df
2 changed files with 41 additions and 17 deletions
+5 -2
View File
@@ -37,10 +37,13 @@ enum MULTI_SYM_MODE{
MULTI_SYM_FX_28 // FX 28 Majors MULTI_SYM_FX_28 // FX 28 Majors
}; };
// used to generate in and out of sample data sets
enum MODE_SPLIT_DATA{ enum MODE_SPLIT_DATA{
NO_SPLIT, NO_SPLIT,
ODD_YEARS, ODD_YEARS,
EVEN_YEARS, EVEN_YEARS,
// ODD_MONTHS, ODD_MONTHS,
// EVEN_MONTHS EVEN_MONTHS,
ODD_WEEKS,
EVEN_WEEKS
}; };
+36 -15
View File
@@ -46,37 +46,59 @@ bool MyFunctions::in_test_period(MODE_SPLIT_DATA data_split_method){
string string_tc = TimeToString(TimeCurrent()); string string_tc = TimeToString(TimeCurrent());
ushort u_sep = StringGetCharacter(".",0); ushort u_sep = StringGetCharacter(".",0);
int split_string = StringSplit(string_tc, u_sep, result); int split_string = StringSplit(string_tc, u_sep, result);
bool odd_year = int(result[0]) % 2;
bool odd_month = int(result[1]) % 2;
// get week of the year. rough estimate can be late the first week of jan:
MqlDateTime dt;
TimeToStruct(TimeCurrent(),dt);
int iDay = (dt.day_of_week + 6 ) % 7 + 1; // convert day to standard index (1=Mon,...,7=Sun)
int iWeek = (dt.day_of_year - iDay + 10 ) / 7; // calculate standard week number
bool odd_week = iWeek % 2;
bool even_year = int(result[0]) % 2;
// bool even_month = int(result[1]) % 2; // need to remove the leading 0 for this to work.
if(data_split_method==NO_SPLIT){ if(data_split_method==NO_SPLIT){
return true; return true;
} }
if(data_split_method==ODD_YEARS){ if(data_split_method==ODD_YEARS){
if (!even_year){ if (odd_year){
return true; return true;
} }
} }
if(data_split_method==EVEN_YEARS){ if(data_split_method==EVEN_YEARS){
if (even_year){ if (!odd_year){
return true; return true;
} }
} }
// if(data_split_method==ODD_MONTHS){ if(data_split_method==ODD_MONTHS){
// if (!even_month){ if (odd_month){
// return true; return true;
// } }
// } }
// if(data_split_method==EVEN_MONTHS){ if(data_split_method==EVEN_MONTHS){
// if (even_month){
// return true; if (!odd_month){
// } return true;
// } }
}
if(data_split_method==ODD_WEEKS){
if (odd_week){
return true;
}
}
if(data_split_method==EVEN_WEEKS){
if (!odd_week){
return true;
}
}
return false; return false;
} }
@@ -92,7 +114,6 @@ bool MyFunctions::is_new_daily_bar(string symbol, datetime start_time){
return false; return false;
} }
double MyFunctions::period_high(string symbol, int periods, int shift){ double MyFunctions::period_high(string symbol, int periods, int shift){
double highs[]; double highs[];