[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 680
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
How do I get in touch with you? I have a lot of questions and would like some advice.
I would replace a switch with a ready-made array, why assign predefined values every time?
Thanks, but could you be more specific? Because the predefined values here are timeframes, but the code following the cases for different indicators will be different... Probably, it's easier to lay out a little more code... :) In general I am very slow today - I couldn't sleep last night and I am still in limbo...
You see - there's absolutely identical code going on, but it's already checking trading criteria of other indictors... I just want to cram all checks of all indices used in the EA into one analytical block, so it would calculate their values once per a tick, put them into variables and use values of the variables for trading decisions. I don't know how to arrange it using an array of predefined values...Thanks, but could you be more specific? Because the predefined values here are timeframes, but the code following the cases for different indicators will be different... Probably, it's easier to lay out a little more code... :) I'm not thinking straight today - I couldn't sleep last night and am still in limbo...
You see - there is absolutely identical code there but it already checks trade criteria of other indirectors... I just want to cram all checks of all indices used in the EA into one analytical block and then it will calculate their values once per a tick, put them into variables and use the values of the variables for trading decisions. I don't know how to arrange it using an array of predefined values...Maybe you just need to select a calculation priority, i.e. it looks like you have
If (BB_1<0 ) is the first mandatory condition after which there is no need to calculate other BB_, well, make a compound if and make necessary BB_ calculations in second if, provided that first if was done, and if ... else is rather effective, while you have only if
I agree, the code may become larger and less readable, but performance will go up
maybe you just need to pick up the computation priority, i.e. like you have
If (BB_1<0 ) is the first mandatory condition, after which there is no need to calculate other BB_, so make a compound if and make the necessary BB_ calculations in the second if, provided the first if was fulfilled, and if . else is rather effective, while you have only if
I agree that your code may become larger and less readable, but performance will go up.
Thanks, Igor, I'll see what happens. That's not what I had in mind... I remember back in the early days of computerization, in 1991-94, I don't remember exactly... I was doing assembly language programming for ZX Spectrum... which was terribly slow and limited to 64Kb of memory... So there was a command to the processor to work with the screen memory area to quickly output 16386Kb to that area. The documented CPU command was the fastest of all the commands dealing with a large data set. There's not much we can do about it, but... they found a way to quadruple the output speed. There were commands for working with the stack and they were executed much faster. This is how they did it: moved the stack to an unused area of memory that goes right after the screen, filled that area with graphical data and then, having moved the stack to the screen, they quickly jumped the screen prepared in memory to the screen area with a command that filled the stack... Just a miracle for those times, but for Spectrum it was magic...
Here too, I'm interested in unconventional ways of working... You know, like see what commands are executed in how many clock cycles and build something similar... What could replace the logical comparison commands, maybe subtraction or something else in the same vein....
And here I'm interested in non-standard ways of working... Like looking up which commands are executed in how many clock cycles and constructing something similar... What could replace the logical comparison commands, maybe subtraction or something like that....
i think you won't find it in mql - the principles of mql are very similar to java with C syntax, try to see which is faster to execute case or if, i remember when i saw in turbopascal that if is faster
Do you know if you can send a command to disable the EA from the script?
You can. I, for example, control my EA with scripts that set global variables to a certain state. The states of these variables
they are analyzed in the Expert Advisor and the necessary commands are executed.