Proposal to the administration and local residents - page 7

 
Vladimir Pastushak:

The question for you is which code do you think is more correct ???

In my opinion, definitely the first one. As it is more transparent, more understandable, and easier to maintain.

Personally, I would only write the first variant, and moreover, if possible, corrected both subsequent variants to the first one.

 
Artyom Trishkin:

Why, are you tripping over a 'fan' of my fingers?

Actually, I'm talking about my fingers. A programmer has a built-in option "conscious choice", a non-programmer does not, so he chooses by the number of lines or something, and often does not understand what is offered to choose. But he takes offense when reminded of this and calls programmers "wimps". For instance
Vladimir:

This is what fear and reluctance are all about. But the fingers are always spread out.

And they are offended for nothing - the difference in qualifications is an objective reality and not just a show-off.
 
Vladimir Pastushak:
At least it works only on the symbol on which the Expert Advisor is installed....

What do you mean? There's a comparison that sifts out all other characters !

I thought wrong code is a code that either performs erroneous actions, or contains potential errors. Here, of the three codes listed below - I would definitely choose the first one just because the second and third are difficult to understand, in them it is much easier to make and then find the error, and if they can not be replaced - there should be a whole page of comments, what formula is used, and why it is exactly the same.

 
Фьючерсные объемы для МТ:

For me, for example, having simple code is more important in MT than being able to assemble it from generic bricks.

And here I would argue.

Copying simple code via Copy-Paste, in my opinion, is more dangerous than using a class which implements common functionality, although it makes the code a bit more complicated.

I think you have to decide for each situation - sometimes it's more reasonable to copy simple code and at other times it's more reasonable to call a generic class.

 
George Merts:

And here I would argue.

Copying simple code via Copy-Paste, in my opinion, is more dangerous than using a class in which common functionality is implemented, although this makes the code a bit more complicated.

I think you have to decide by situation - sometimes it's more reasonable to copy simple code, sometimes it's more reasonable to call a generic class.

Actually here is a simple and clear code, while the previous three samples are not very good

index_rsi = (int)((rsi-50.0)/10.000001);
 
Vladimir Pastushak:

In fact, here is simple and straightforward code, and the previous three examples not so much

there's a saying: "if you think clearly, you write clearly", so with "simple and straightforward code".

Plain is when it's clear.

Simple is when it's simple.

 
Andrey F. Zelinsky:

There's a saying: "He who thinks clearly, speaks clearly", and so it is with "plain and simple code".

clear is when it's clear.

Simple is when it's simple.

And in short code there's less room for mistakes. :)

 
Vladimir Pastushak:

In fact, here's simple and straightforward code, and the previous three examples not so much

Yes, that's right. There was no such code in the selection, though - so you changed the conditions on the fly.


But this code is good when we have a clear dependence in the form of a formula. This rarely happens. More often - there are certain ranges for different variants, which are identified by genetic optimization - and then the first variant is much more correct than trying to "fit the formula" to the found boundaries.

Thus - in order to evaluate the code you need to know the situation fully.

 
George Merts:

Yes, that's right. There was no such code in the selection, though - so you changed the conditions as you went along.


But this code is good when we have a clear dependency in the form of a formula. This rarely happens. More often - there are certain ranges for different variants, which are identified by genetic optimization - and then the first variant is much more correct than trying to "fit the formula" to the found boundaries.

So, to evaluate the code you need to be fully aware of the situation.

I didn't adjust the code, I purposely did not specify it, if you read the correspondence in the article you will see this code there... I just wanted to know if someone would offer a better code...

You need to know the situation anyway...

 
Vladimir Pastushak:

...

index_rsi = (int)((rsi-50.0)/10.000001);

a masterpiece, no doubt
Reason: