update
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
#property library
|
||||
#include <Trade/Trade.mqh>
|
||||
#include <MyLibs/TimeZones.mqh>
|
||||
#include <MyLibs/Myfunctions.mqh>
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
+11
-10
@@ -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){
|
||||
|
||||
|
||||
@@ -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",};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user