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.
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.
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 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.
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.
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.
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.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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