If statement is irrelevant. if(bool) is the same as bool isSel=bool; if(isSel);.
Increase Order after stoploss - MQL4 programming forum #1.3 (2017)
If statement is irrelevant. if(bool) is the same as bool isSel=bool; if(isSel);.
Increase Order after stoploss - MQL4 programming forum #1.3 (2017)
Yes, I seem to be going in circles and/or working myself in a corner.
This code was based on my idea of multiple selections
https://www.mql5.com/en/forum/451149
I thought I might select properties and then when each property is true to assign the proper indicator or bool comparison to that.
Such as selections = bool && bool; or selections = bool && bool && bool
if(selections) code
if(!selections) code
This way instead of changing the comparison I could change it dynamically from the properties by selecting true or false etc.
I couldn't think of anything else to make a dynamically changed comparison.
Thanks for the replies.
- 2023.07.21
- www.mql5.com
What data type can be used as literal text as if I were typing the function name or variable name into the comparison manually ?
I thought a string might do this or to assign a variable with the same typed text but I see now this is not as I intended it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can this even be done as intended ?
For example:
extern bool chart_period=true; // extern bool macdm1=false; extern bool macdm5=false; extern bool macdm15=false; extern bool macdh1=false; extern bool macdh4=false; extern bool macdd1=false; string selections; void selection() //perhaps better for switch and case. { if(chart_period && !macdm1 && !macdm5 && !macdm15 && !macdh1 && !macdh4 && !macdd1) selections="histo()"; if(chart_period && macdm1 && !macdm5 && !macdm15 && !macdh1 && !macdh4 && !macdd1) selections="histo() && histo_M1()"; if(chart_period && macdm1 && macdm5 && !macdm15 && !macdh1 && !macdh4 && !macdd1) selections="histo() && histo_M1() && histo_M5()"; }
These are bools in the comparisons. Not sure how to convert back to use for a comparison.Or if I should be using "bool selections" instead but I'm not sure how Logical Operation && views this without "if" ?
For example instead:
Is the && use even a valid option ? and if so what is the assignment if it can even be used like this.
I know the references and book only show examples of if(&&) comparisons and I understand it's used that way but never considered if possible to use in an assignment if it can even be done.
Please advise and educate me on this please.
Thanks