You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Yes, Natalia - that was just a "When they pay you for a line of code" meme.
That's the kind of humor programmers have.
You don't need a function in your case.
You just need to form the variables Volume1 ... Volume10 first form an array Volume[10]
and then use index n to refer to its items volume[n].
Do not worry - almost every programmer has gone through this.
The main thing is that you really like programming. I can feel it.
So you'll go far.
Tell me how to write it nicely. I do not want to duplicate arrays of code.
The Expert Advisor uses 2 indicators.
and conditions for order opening look like this now:
But I would like to add a filter in settings
so that I can disable 1 indicator or the second indicator in the settings.Use or not use 1 or 2 indicators
Only I don't know how to implement it more correctly.
It would look something like this:
Can't figure out how to do it without copying a lot of code.....
Please advise how to write it nicely. So as not to duplicate code arrays.
The Expert Advisor uses 2 indicators.
and conditions for order opening look like this now:
But I would like to add filter
That I could turn off 1 indicator or the other in the settings.Use or not use 1 or 2 indicators
Only I don't know how to implement it more correctly.
It would look like this:
Can't figure out how to do it without copying a lot of code.....
I have written a bit about it here: https://www.mql5.com/ru/forum/6343/page1384#comment_26447195
I have written a little on the subject here: https://www.mql5.com/ru/forum/6343/page1384#comment_26447195
Natalya Smirnova #:
so that I can disable 1 indicator or the second indicator in the settings.
I can't figure out how to do it without copying a lot of code.....
Write the condition of the indicator in the function and if it should not be checked, then the condition is fulfilled. Return TRUE.
Please advise how to write it nicely. So as not to duplicate code arrays.
The Expert Advisor uses 2 indicators.
and conditions for order opening look like this now:
But I would like to add filter
That I could disable 1 indicator or the second indicator in the settings.Use or not use 1 or 2 indicators
Only I don't know how to implement it more correctly.
It would look like this:
I can't figure out how to do it without copying a lot of code.....
Still the variable for the use condition and the variable for the output value of the indicator should be different variables.
Just in case: Exclamation mark means inversion of bool valueAnd if the variables for the use condition will be ind_1 and ind_2, then, for example, you could do this:
Still, the variable for the use condition and the variable for the output value of the indicator should be different variables.
And if variables for use condition will be ind_1 and ind_2, then, for example, we can do this:
ind_1 = !(ind_1 && !(Indicator1>0));
the abundance of brackets and inversions in the logical expression sort of suggests that one could simplify...
PS/ architecturally it's a slag in general. If indicator readings can be grouped without any trading factors (regardless of where you opened what), then it's an indicator and it has nothing to do with robot's trading logic. It has to be rendered and available for analysis.
The abundance of brackets and inversions in the logic expression sort of suggests that it can be simplified...
PS/ Architecturally, it's a slag. If indicator readings can be grouped together without any trading factors (regardless of where you opened what), then it's an indicator and has no place in a robot's trading logic. It has to be rendered and available for analysis.
Maybe.
!a || b
:)
!a || b
:)
So a shorter version:
or single-line version with original ind_1 and ind_2 preserved