I teach from scratch, as well as help newcomers to join the ranks of MQL4 professionals. - page 7
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
Do you have nothing better to do than to spend hours looking for some flaws in my code or am I a pain in the ass and you want to get back at me?
You're a strange man, Andrew...
What's the forum for? -- For fun.
i'm having my tea out of a saucer and some cakes -- i look through forum and maybe i'll find something for fun -- your topic is funny (i always liked this one).
p.s. why do you need revenge, and for what reason? -- p.s.2 don't be angry with me - it's funny, your topic's always been a learning curve for me.
p.s.2 don't be angry, I deleted my post - maybe it was really prickly - it wasn't meant to offend you in any way
so what's the forum for? -- for fun.
i'm having a cup of tea and crumpets -- i'm browsing the forum, maybe i'll find something for fun -- your topic is funny (i've always liked the learning theme).
p.s. why do you need revenge and what for? - I do not understand
Besides, Dimochka, you're the one who attacked me first -- I'm purely the injured party.
You're such an innocent girl. Breaking into my crib, telling me how to live my life. All I said was the whole truth. Apparently, the truth got in your throat and you decided to find some kind of a clue to somehow spite me. But the more you rant, the more you humiliate yourself. You can continue to provoke me by humiliating yourself in front of others. This is a forum, a forum for hilarity. Moreover, it's not only you and I who read it... )))
I wrote to you:
p.s.2 don't be mad, I deleted my post -- maybe it was a prickly one -- I didn't mean to offend you in any way
-- and you keep attacking -- I probably shouldn't have deleted my post.
You -- I wrote to you:
-- and you keep attacking -- I must have deleted my post for nothing.
This thread is designed to help those who are trying to learn but find it long and painful. I just offered my help in faster learning of the language, plus an understanding of how it works in computer memory, so that I could program the best code at once, instead of doing "somehow", and then trying to optimize it... )))
I think such constructions are not very optimal:
It would be better to assign the result of the iBars() function to a variable before the for operator, since "Expression2" is checked for truth after each iteration, and each time the function is called it will take more time than comparing it to a variable.
In my opinion, such designs are not very optimal:
It would be better to assign the result of iBars() function to a variable before the for statement, since "Expression2" is checked for truth after each iteration, and each time the function is called, it will take more time than comparing it with the variable.
I agree, that's mostly what I do. And if it makes no difference where to start the pass, then I write for(int i=iBars(NULL,SarPeriod)-1; i>=0; i--). This is optimal for the process and less characters in the string. In this code, I wasn't aimed at 100% optimization - I had to make fewer strings, so I wrote it that way... )))
The thing that "eats" the process most of all is iCustom etc., and I've got plenty of them there. I should write the algorithms of all indicators I use in the Expert Advisor itself to make it "fly", but I didn't have such a task...
I agree, that's basically what I do. And if it makes no difference where to start pass, then I write for(int i=iBars(NULL,SarPeriod)-1; i>=0; i--). This is optimal for the process and less characters in the string. In this code, I wasn't aimed at 100% optimization - I had to make fewer strings, so I wrote it that way... )))
In my opinion, such designs are not very optimal:
It would be better to assign the result of iBars() to a variable before the for statement, because "Expression2" is tested for truth after each iteration, and each time the function is called, it will take more time than comparing with the variable.
It doesn't really matter that much. I remember Knuth's "The Art of Programming" saying something like this - a good programmer should:
1. be able to shorten or optimize any program,
2. never do it.
It's not really that important. I remember Knuth's The Art of Programming saying something like this - a good programmer should:
1. be able to shorten or optimise any program,
2. never do it.
I like this approach better.
When I write my functions, they are long and complex. They contain multi-level indents and nested loops. They have long lists of arguments. Names are chosen chaotically and there are duplicates in the code. But I also have a suite of unit tests for all these clunky lines up to the last one.
So, I start "combing" and refining my code, highlighting new functions, changing names and eliminating duplicates. I shorten methods and reorder them. Sometimes I have to break entire classes, but I make sure that all tests run successfully.
In the end, I'm left with functions built according to the rules outlined in this category. I don't write them down that way from the start. And I don't think anyone can do it at all.
Robert Martin, Clean Code. Creation, analysis and refactoring.
Some people are able and do it, some people are able and don't do it, it's a matter of how one does it.
I like this approach better
Some can and do, some can and don't, it's a matter of how you do it.