need example / advise how method for makeing multiple selections or multiple properties.

 
I'm asking generically for concept ideas because I don't really understand where to start.
I'm trying to figure out how to toggle multiple indicators for EA backtesting so that I don't have to change each comparison line in the the code everytime. 

I was thinking perhaps bool properties for selections then assign those to a variable if true, but this also complicates things. 

Is there a common concept for this for mulitiple indicator selections for EA backtesting ? 

I'm reading now about the switch operator and case. Perhaps this is what I need to do. 

Anyhow advise would be great
Thanks
Testing trading strategies on real ticks
Testing trading strategies on real ticks
  • www.mql5.com
The article provides the results of testing a simple trading strategy in three modes: "1 minute OHLC", "Every tick" and "Every tick based on real ticks" using actual historical data.
 
Agent86:
I'm asking generically for concept ideas because I don't really understand where to start.
I'm trying to figure out how to toggle multiple indicators for EA backtesting so that I don't have to change each comparison line in the the code everytime. 

I was thinking perhaps bool properties for selections then assign those to a variable if true, but this also complicates things. 

Is there a common concept for this for mulitiple indicator selections for EA backtesting ? 

I'm reading now about the switch operator and case. Perhaps this is what I need to do. 

Anyhow advise would be great
Thanks
Could you lay out in code what you are trying to accomplish.
 
Dominik Christian Egert #:
Could you lay out in code what you are trying to accomplish.

Well, something like this.

external double  selection;
internal bool histo1,histo2,histo3,histo4;

if(histo1 && histo2 == true)
histo1 = histo()
histo2= histo_H4()   //or something like this just to outline the idea. 

if(histo() && histo_H4())
selection = histo() && histo_H4

if (histo() && histo_H4 && histo_1H)
selection = (histo() && histo_H4 && histo_1H)

if (histo() && histo_H4 && histo_1H)
selection = (histo() && histo_H4 && histo_1H && histo)_M15)


//but double would likely not be correct, probably a string or something. 
//just wondered if there is a commonly used method for backetesting so that you don't have to make so many changes, but can simply select something in properties that will be the variable everywhere else. 

I know this code above would be disfunctionaly but wanted to outline the idea in short. 

To outline the concept. I want to select an indicator, or multiple indicators from properties. 

And then those indicators when selected will be the comparison that I'm using for backtesting etc. 
Meaning either trade MACD,RSI,Fractals if that is my selections or perhaps trade SMA10,SMA20,Bollinger etc. 

Instead of writing this every time I could make selections to hone in on better performance without making so many changes all the time. 


 
Agent86 #:

Well, something like this.

I know this code above would be disfunctionaly but wanted to outline the idea in short. 

To outline the concept. I want to select an indicator, or multiple indicators from properties. 

And then those indicators when selected will be the comparison that I'm using for backtesting etc. 
Meaning either trade MACD,RSI,Fractals if that is my selections or perhaps trade SMA10,SMA20,Bollinger etc. 

Instead of writing this every time I could make selections to hone in on better performance without making so many changes all the time. 


I understand. So the idea is to have some sort of "EA template" to test various indicator combinations. And eventually even use optimization to find good matches among.

You need to solve at least the input parameter problem. Different indicators have different properties.

Then you would need to find a way on how to select the comparison types...

You will end up with a lot of inputs. And your algorithm will be quite high level programming.

You will need inheritance and templates in excessive ways to achieve this modularity inside one EA.

Well, I am not saying it's impossible, but it is for sure quite a complex endeavor.

Also, how about integrating multiple timeframes, and maybe cross-symbol-corelation...

You will end up building a beast of software. If you lay it out, and have enough experience, this could be doable.

But I guess, your question shows, you are missing some of what (I personally think) it takes to lay out a concept and then in fact code that.

My suggestion, select a small amount of indicators, code them into the EA statically, use inputs to select which comparisons you want to use between them... Make some of them on/off switchable.

I guess that could be achieved and should not be too complicated.
 
Is there a common concept for this for mulitiple indicator selections for EA backtesting ? 
If your EA is opening trades, can you assign a magic number,  unique to each indicator when it identifies a trade, and then code the win rate etc as time progresses?
 
Thanks all, 

I have enough knowledge to make all the comparisons and make all the changes manually. 

And since I was manually doing it I thought it might be better to code something that will make these changes upon a properties selection instead. 

I never knew I could do something with indicators and magic numbers I thought this was something used mostly for the trade properties only. 

Good to know and thanks, I'll read into some more this give me some ideas to work from. 
 
Dominik Christian Egert #:
I understand. So the idea is to have some sort of "EA template" to test various indicator combinations. And eventually even use optimization to find good matches among.

You need to solve at least the input parameter problem. Different indicators have different properties.

Then you would need to find a way on how to select the comparison types...

You will end up with a lot of inputs. And your algorithm will be quite high level programming.

You will need inheritance and templates in excessive ways to achieve this modularity inside one EA.

Well, I am not saying it's impossible, but it is for sure quite a complex endeavor.

Also, how about integrating multiple timeframes, and maybe cross-symbol-corelation...

You will end up building a beast of software. If you lay it out, and have enough experience, this could be doable.

But I guess, your question shows, you are missing some of what (I personally think) it takes to lay out a concept and then in fact code that.

My suggestion, select a small amount of indicators, code them into the EA statically, use inputs to select which comparisons you want to use between them... Make some of them on/off switchable.

I guess that could be achieved and should not be too complicated.

I think I can code this with some ideas I have but wondered if there were a more typical method since I'm sure someone has done it already. 

I may play with switch operator might be my best option. 

 
Dominik Christian Egert #:
My suggestion, select a small amount of indicators, code them into the EA statically, use inputs to select which comparisons you want to use between them... Make some of them on/off switchable.

I'm not finding any common methods, but have ideas of my own. 

The main problem I am running into is create a variable for comparison that is actually the literal text that I want to input / assign to the variable. 

For example:
Assuming I have 2 bool functions, for up macd = true, down macd = false.

bool histo_M5()
   {
   if(histo_M5 > 0) return(true);
   else return(false);
   }

bool histo_M15()
   {
   if(histo_M15 > 0) return(true);
   else return(false);
   }

And lets say the following comparison is something I would write into the EA  *currently functional. 

if(histo_M5()  &&  histo_M15())


These are bools and if both are == true then we enter the code block. 

But how would I assign a bool to a variable for use in the comparison ??

I know I can assigne a single bool such as:

seletions = histo_M5;

However, how would I assign multiple bools to the same variable such as:

selections = histo_M5 && histo_H1;

I am uncertain what the correct syntax of this might be or how to input these fuctions into the comparison. 
If I use selections = "histo_M5 && histo_H1";  this solves the problem of correctly formatted text, but the data type is then wrong. 

I'm not sure how to convert this back to bools and in the comparison etc. 
I may be on the wrong track with these data types but the ease of selecting from properties true/false seemed simple at the time. 

Thanks for any ideas on this. 

 
Agent86 #:

I'm not finding any common methods, but have ideas of my own. 

The main problem I am running into is create a variable for comparison that is actually the literal text that I want to input / assign to the variable. 

For example:
Assuming I have 2 bool functions, for up macd = true, down macd = false.

And lets say the following comparison is something I would write into the EA  *currently functional. 


These are bools and if both are == true then we enter the code block. 

But how would I assign a bool to a variable for use in the comparison ??

I know I can assigne a single bool such as:

However, how would I assign multiple bools to the same variable such as:

I am uncertain what the correct syntax of this might be or how to input these fuctions into the comparison. 
If I use selections = "histo_M5 && histo_H1";  this solves the problem of correctly formatted text, but the data type is then wrong. 

I'm not sure how to convert this back to bools and in the comparison etc. 
I may be on the wrong track with these data types but the ease of selecting from properties true/false seemed simple at the time. 

Thanks for any ideas on this. 

I don't understand what you are trying to accomplish...


Reason: