[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 301

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
I've done everything exactly the same way and more than once, but there's still that hole.
A question for the experts!
I often have wizards in my EAs. In order not to "litter" the code with repetitive moments, like:
Such repetitions can be in order. I wanted to get rid of them by writing separate functions.
Here is the beginning:
We can go further, declaring globally variables for wipes, e.g. fastMA and slowMA, and return them by reference via function :
You would get something like this:
The question is this:
I've heard or read somewhere that switch operator is slow, won't it affect performance of EA in general in this case? In general, how slow is it?
Many parameters come out here, won't it slow down an Expert Advisor?
I am writing and thinking about productivity, so the question arises, as I am not a programmer by training, to understand it myself, not really comes out ...
Victor, the function call is much more of a brake than switch. You can check the speed yourself. Write a test code with a loop. Where you will check your code. Measure the time at the input. Then compare it with the output time.
The switch operator is one of the fastest operators. It's faster than running through the conditions.
Switch should be used with a default on exceptions. So that in case of an incorrect condition you would know why the code does not work.
Hmm. I guess you can't use a constant for case as a variable, according to the documentation. It says some kind of target constant, character constant or character expression.
It only works if you set a string-type letter, i.e. 1 character (if more than 1 character, the compiler swears) or a number.
Nothing else.
It says some target constants, character expressions and character constants.
Where can I read about using global terminal variables with practical examples? Specifically, I want to make each Expert Advisor trade only its share of the deposit and its profit/slippage does not affect the MM of other Expert Advisors.
Hi all
Can you advise what may be the cause of the "shutdown by timeout" error, when running the Expert Advisor in the terminal and how to solve this problem?