From f4ff6ac4b000a9145ac4a2eb3435a10dce13ae35 Mon Sep 17 00:00:00 2001 From: Matt Corcoran Date: Sat, 9 Nov 2024 12:00:51 +0100 Subject: [PATCH] update --- ExitIndicators.mqh | 90 +++++++++++++++++++++++++++++++++++++++++ MyFunctions.mqh | 21 +++++----- NNFX_TestFileHeader.mqh | 1 + 3 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 ExitIndicators.mqh diff --git a/ExitIndicators.mqh b/ExitIndicators.mqh new file mode 100644 index 0000000..2deb5a6 --- /dev/null +++ b/ExitIndicators.mqh @@ -0,0 +1,90 @@ +#property library +#include +#include +#include + +enum EXIT_INDICATORS_LIST{ + AROON, + ASO, +}; + +class ExitIndicators : public CObject{ + + protected: + int handle; + + public: + int init_exit_indi_handle(EXIT_INDICATORS_LIST indi, string symbol, ENUM_TIMEFRAMES time_frame); + bool get_exit_indi_bool(EXIT_INDICATORS_LIST indi, int exit_handle, int data_type); + +}; + +int ExitIndicators::init_exit_indi_handle(EXIT_INDICATORS_LIST indi, string symbol, ENUM_TIMEFRAMES time_frame){ + + if(indi==AROON){ + handle=iCustom(symbol, time_frame, "MyIndicators\\AROON.ex5"); + + } + if(indi==ASO){ + handle=iCustom(symbol, time_frame, "MyIndicators\\ASO.ex5", 26, 9, 0, 3); + + } + return handle; +} + +bool ExitIndicators::get_exit_indi_bool(EXIT_INDICATORS_LIST indi, int exit_handle, int data_type){ + + bool long_exit; + bool short_exit; + + if(indi==AROON){ + + double indi_up[]; + ArraySetAsSeries(indi_up, true); + CopyBuffer(exit_handle,0,1,10,indi_up); + + double indi_down[]; + ArraySetAsSeries(indi_down, true); + CopyBuffer(exit_handle,1,1,10,indi_down); + + long_exit = ( + indi_up[0] < indi_down[0] + && indi_up[1] > indi_down[1] + ); + + short_exit = ( + indi_up[0] > indi_down[0] + && indi_up[1] < indi_down[1] + ); + } + + + if(indi==ASO){ + + double Bulls[]; + ArraySetAsSeries(Bulls, true); + CopyBuffer(exit_handle,0,1,10,Bulls); + + double Bears[]; + ArraySetAsSeries(Bears, true); + CopyBuffer(exit_handle,1,1,10,Bears); + + long_exit = ( + Bulls[0] < Bears[0] + && Bulls[1] > Bears[1] + ); + + short_exit = ( + Bulls[0] > Bears[0] + && Bulls[1] < Bears[1] + ); + } + + + if(data_type==1){return long_exit;} + + if(data_type==2){return short_exit;} + + return false; + +} diff --git a/MyFunctions.mqh b/MyFunctions.mqh index 31e9809..e11c832 100644 --- a/MyFunctions.mqh +++ b/MyFunctions.mqh @@ -39,6 +39,17 @@ bool MyFunctions::is_new_bar(string symbol, ENUM_TIMEFRAMES time_frame){ 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) + bar_open_time = iTime(symbol,PERIOD_D1,0); + if(previousTime!=bar_open_time && TimeCurrent() > start_time){ + previousTime=bar_open_time; + return true; + } + return false; +} + //if(!mf.in_test_period(data_split_method){return;} bool MyFunctions::in_test_period(MODE_SPLIT_DATA data_split_method){ @@ -103,16 +114,6 @@ bool MyFunctions::in_test_period(MODE_SPLIT_DATA data_split_method){ 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) - bar_open_time = iTime(symbol,PERIOD_D1,0); - if(previousTime!=bar_open_time && TimeCurrent() > start_time){ - previousTime=bar_open_time; - return true; - } - return false; -} double MyFunctions::period_high(string symbol, int periods, int shift){ diff --git a/NNFX_TestFileHeader.mqh b/NNFX_TestFileHeader.mqh index 668b3fa..38c243b 100644 --- a/NNFX_TestFileHeader.mqh +++ b/NNFX_TestFileHeader.mqh @@ -22,5 +22,6 @@ 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",};