Git update
This commit is contained in:
+7
-11
@@ -36,7 +36,7 @@ double CustomMax::calculate_custom_criteria(CUSTOM_MAX_TYPE cm_type){
|
||||
custom_criteria = win_loss_ratio();
|
||||
}
|
||||
if(cm_type==CM_WIN_PERCENT){
|
||||
custom_criteria = win_percent();
|
||||
custom_criteria = win_percent_min_trades(0);
|
||||
}
|
||||
if(cm_type==CM_WIN_PERCENT_200T){
|
||||
custom_criteria = win_percent_min_trades(200);
|
||||
@@ -73,22 +73,18 @@ double CustomMax::win_loss_ratio(){
|
||||
double losses = TesterStatistics(STAT_LOSS_TRADES);
|
||||
return wins/losses;
|
||||
}
|
||||
|
||||
double CustomMax::win_percent(){
|
||||
double wins = TesterStatistics(STAT_PROFIT_TRADES);
|
||||
double total_trades = TesterStatistics(STAT_TRADES);
|
||||
return wins / total_trades * 100;
|
||||
}
|
||||
|
||||
double CustomMax::win_percent_min_trades(int min_resuired_trades){
|
||||
double wins = TesterStatistics(STAT_PROFIT_TRADES);
|
||||
double total_trades = TesterStatistics(STAT_TRADES);
|
||||
double result = wins / total_trades * 100;
|
||||
|
||||
if(total_trades<min_resuired_trades){
|
||||
if(!MathIsValidNumber(result) || total_trades<min_resuired_trades){
|
||||
return 0;
|
||||
}
|
||||
|
||||
else {
|
||||
return wins / total_trades * 100;
|
||||
else{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,11 @@ enum TIME_ZONES{
|
||||
Mosc, // Moscow
|
||||
Tok, // Tokyo - no DST
|
||||
};
|
||||
|
||||
enum MULTI_SYM_MODE{
|
||||
MULTI_SYM_CHART, // Chart Symbol only
|
||||
MULTI_SYM_FX_B5, // FX Benchmark 5
|
||||
MULTI_SYM_FX_28 // FX 28 Majors
|
||||
};
|
||||
|
||||
// used to generate in and out of sample data sets
|
||||
enum MODE_SPLIT_DATA{
|
||||
NO_SPLIT,
|
||||
|
||||
+27
-69
@@ -12,9 +12,6 @@ class MyFunctions : public CObject{
|
||||
datetime bar_open_time;
|
||||
|
||||
public:
|
||||
// bool is_new_daily_bar(string symbol, datetime start_time);
|
||||
double period_high(string symbol, int periods, int shift);
|
||||
double period_low(string symbol, int periods, int shift);
|
||||
void draw_line(double value, string name,color clr);
|
||||
bool check_indicator_handles(int &indicator_handles[]);
|
||||
double adjusted_point(string symbol);
|
||||
@@ -22,8 +19,34 @@ class MyFunctions : public CObject{
|
||||
bool is_new_bar(string symbol, ENUM_TIMEFRAMES time_frame, string daily_start_time="00:10");
|
||||
bool trade_window(string t1, string t2, string time_zone, bool plot_range_inp=true);
|
||||
bool in_test_period(MODE_SPLIT_DATA data_period);
|
||||
void get_white_list(MULTI_SYM_MODE mode, string& DataArray[]);
|
||||
};
|
||||
|
||||
void MyFunctions::get_white_list(MULTI_SYM_MODE mode, string& DataArray[]){
|
||||
|
||||
if(mode==MULTI_SYM_CHART){
|
||||
string a[] = {_Symbol};
|
||||
ArrayResize(DataArray, ArraySize(a));
|
||||
for(int i = 0; i < ArraySize(DataArray); i++){
|
||||
DataArray[i]=a[i];
|
||||
}
|
||||
}
|
||||
if(mode==MULTI_SYM_FX_B5){
|
||||
string a[] = {"EURUSD", "AUDNZD", "EURGBP", "AUDCAD", "CHFJPY"};
|
||||
ArrayResize(DataArray, ArraySize(a));
|
||||
for(int i = 0; i < ArraySize(DataArray); i++){
|
||||
DataArray[i]=a[i];
|
||||
}
|
||||
}
|
||||
if(mode==MULTI_SYM_FX_28){
|
||||
string a[] = {"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",};
|
||||
ArrayResize(DataArray, ArraySize(a));
|
||||
for(int i = 0; i < ArraySize(DataArray); i++){
|
||||
DataArray[i]=a[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool MyFunctions::trade_window(string t1, string t2, string time_zone="Broker", bool plot_range_inp=true){
|
||||
bool in_window = tw.define_window(t1, t2, time_zone, plot_range_inp);
|
||||
return in_window;
|
||||
@@ -37,7 +60,6 @@ bool MyFunctions::is_new_bar(string symbol, ENUM_TIMEFRAMES time_frame, string d
|
||||
|
||||
if(PeriodSeconds(time_frame)==PeriodSeconds(PERIOD_D1)){
|
||||
if(TimeCurrent() > StringToTime(daily_start_time)){
|
||||
Print("new bar");
|
||||
previousTime=bar_open_time;
|
||||
return true;
|
||||
}
|
||||
@@ -116,39 +138,6 @@ bool MyFunctions::in_test_period(MODE_SPLIT_DATA data_split_method){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
double MyFunctions::period_high(string symbol, int periods, int shift){
|
||||
|
||||
double highs[];
|
||||
ArraySetAsSeries(highs,true);
|
||||
CopyHigh(symbol,PERIOD_CURRENT,1,periods+1,highs);
|
||||
|
||||
double high = 0;
|
||||
high=highs[shift];
|
||||
for(int i=shift; i<shift+periods; i++){
|
||||
if(high<highs[i]){
|
||||
high=highs[i];
|
||||
}
|
||||
}
|
||||
return(high);
|
||||
}
|
||||
|
||||
double MyFunctions::period_low(string symbol, int periods, int shift){
|
||||
|
||||
double lows[];
|
||||
ArraySetAsSeries(lows,true);
|
||||
CopyLow(symbol,PERIOD_CURRENT,1,periods+1,lows);
|
||||
|
||||
double low = 0;
|
||||
low=lows[shift];
|
||||
for(int i=shift; i<shift+periods; i++){
|
||||
if(low>lows[i]){
|
||||
low=lows[i];
|
||||
}
|
||||
}
|
||||
return(low);
|
||||
}
|
||||
|
||||
void MyFunctions::draw_line(double value, string name,color clr){
|
||||
// EG:
|
||||
// ArrayResize(bar,1000);
|
||||
@@ -180,22 +169,6 @@ void MyFunctions::draw_line(double value, string name,color clr){
|
||||
ChartRedraw();
|
||||
}
|
||||
|
||||
bool MyFunctions::check_indicator_handles(int &indicator_handles[]){
|
||||
// TODO check if working before implementaion:
|
||||
// e.g. call via:
|
||||
// int indicator_handles[] = {handle1, handle2, handle..};
|
||||
// check_indicator_handles(indicator_handles);
|
||||
|
||||
for(int i =0; i < ArraySize(indicator_handles); i++){
|
||||
|
||||
if(indicator_handles[i] == INVALID_HANDLE){
|
||||
Alert("Failed to create handle"); return false;
|
||||
};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double MyFunctions::adjusted_point(string symbol){
|
||||
|
||||
int symbol_digits = (int)SymbolInfoInteger(symbol, SYMBOL_DIGITS);
|
||||
@@ -235,19 +208,4 @@ double MyFunctions::get_bid_ask_price(string symbol, int price_side){
|
||||
|
||||
return price;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 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;
|
||||
// }
|
||||
}
|
||||
@@ -6,12 +6,13 @@ CustomMax cm;
|
||||
MyFunctions mf;
|
||||
OrderManagment om;
|
||||
//---
|
||||
string SymbolsArray[];
|
||||
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 double inp_sl_var = 1.5; // 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
|
||||
input double inp_tp_var = 1; // Take-Profit Var
|
||||
string lot_mode = EnumToString(inp_lot_mode);
|
||||
string sl_mode = EnumToString(inp_sl_mode);
|
||||
string tp_mode = EnumToString(inp_tp_mode);
|
||||
@@ -20,8 +21,8 @@ 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",};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user