diff --git a/MyEnums.mqh b/MyEnums.mqh index 7f1f029..2926a55 100644 --- a/MyEnums.mqh +++ b/MyEnums.mqh @@ -35,4 +35,12 @@ enum MULTI_SYM_MODE{ MULTI_SYM_CHART, // Chart Symbol only MULTI_SYM_FX_B5, // FX Benchmark 5 MULTI_SYM_FX_28 // FX 28 Majors +}; + +enum MODE_SPLIT_DATA{ + NO_SPLIT, + ODD_YEARS, + EVEN_YEARS, + // ODD_MONTHS, + // EVEN_MONTHS }; \ No newline at end of file diff --git a/MyFunctions.mqh b/MyFunctions.mqh index 9634c92..80ac591 100644 --- a/MyFunctions.mqh +++ b/MyFunctions.mqh @@ -1,6 +1,7 @@ #property library #include #include +#include class MyFunctions : public CObject{ @@ -20,7 +21,7 @@ class MyFunctions : public CObject{ double get_bid_ask_price(string symbol, int price_side); bool is_new_bar(string symbol, ENUM_TIMEFRAMES time_frame); bool trade_window(string t1, string t2, string time_zone, bool plot_range_inp=true); - + bool in_test_period(MODE_SPLIT_DATA data_period); }; bool MyFunctions::trade_window(string t1, string t2, string time_zone="Broker", bool plot_range_inp=true){ @@ -38,6 +39,48 @@ bool MyFunctions::is_new_bar(string symbol, ENUM_TIMEFRAMES time_frame){ return false; } +//if(!mf.in_test_period(data_split_method){return;} +bool MyFunctions::in_test_period(MODE_SPLIT_DATA data_split_method){ + + string result[]; + string string_tc = TimeToString(TimeCurrent()); + ushort u_sep = StringGetCharacter(".",0); + int split_string = StringSplit(string_tc, u_sep, result); + + 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){ + return true; + } + + if(data_split_method==ODD_YEARS){ + if (!even_year){ + return true; + } + } + + if(data_split_method==EVEN_YEARS){ + if (even_year){ + return true; + } + } + + // if(data_split_method==ODD_MONTHS){ + // if (!even_month){ + // return true; + // } + // } + + // if(data_split_method==EVEN_MONTHS){ + // if (even_month){ + // return true; + // } + // } + + return false; +} + // e.g. if(!mf.is_new_daily_bar(symbol, StringToTime("00:06"))){return;} bool MyFunctions::is_new_daily_bar(string symbol, datetime start_time){ // https://www.youtube.com/watch?v=9BdnTcGrlUM (m-25:00) diff --git a/NNFX_TestFileHeader.mqh b/NNFX_TestFileHeader.mqh new file mode 100644 index 0000000..668b3fa --- /dev/null +++ b/NNFX_TestFileHeader.mqh @@ -0,0 +1,26 @@ +#include +#include +#include +#include +CustomMax cm; +MyFunctions mf; +OrderManagment om; +//--- +input LOT_MODE inp_lot_mode = LOT_MODE_PCT_RISK; // Lot Size Mode +input double inp_lot_var = 2; // Lot Size Var +input SL_MODE inp_sl_mode = SL_ATR_MULTIPLE; // Stop-loss Mode +input double inp_sl_var = 1; // Stop-loss Var +input TP_MODE inp_tp_mode = TP_ATR_MULTIPLE; // Take-profit Mode +input double inp_tp_var = 1.5; // Take-Profit Var +string lot_mode = EnumToString(inp_lot_mode); +string sl_mode = EnumToString(inp_sl_mode); +string tp_mode = EnumToString(inp_tp_mode); +input CUSTOM_MAX_TYPE inp_custom_criteria = CM_WIN_PERCENT_200T; +input MULTI_SYM_MODE inp_sym_mode = MULTI_SYM_FX_B5; +input MODE_SPLIT_DATA inp_data_split_method = NO_SPLIT; +input int inp_force_opt = 1; +input group "-----------------------------------------" +//---- +string bm5_symbols[] = {"EURUSD", "AUDNZD", "EURGBP", "AUDCAD", "CHFJPY"}; +string fx28_symbols[] = {"EURUSD","AUDNZD","AUDUSD","AUDJPY","EURCHF","EURGBP","EURJPY","GBPCHF","GBPJPY","GBPUSD","NZDUSD","USDCAD","USDCHF","USDJPY","CADJPY","EURAUD","CHFJPY","EURCAD","AUDCAD","AUDCHF","CADCHF","EURNZD","GBPAUD","GBPCAD","GBPNZD","NZDCAD","NZDCHF","NZDJPY",}; +