Self-learning the MQL5 language from scratch - page 49

 
MrBrooklin:

Peter, so we create the trailing code in the script? Great! What you have listed I now take as basic sections and start to describe them in words, so that it is clear how to write functions, loops, etc. later. Is this correct?

Regards, Vladimir.

You can't use any script for trailing. This undermines the very idea of what I am trying to tell you.
I will write later at my computer.
We have one general line: we use only functions. I will write how later.
 
Vasiliy Sokolov:
You cannot use any script for trailing. It undermines the very idea of what I am trying to tell you.
I'll write later on the computer.
The general line is the same: we only use functions. How - I'll write later.

Got it, Vassili! I put everything on hold then.

Regards, Vladimir.

 
Vasiliy Sokolov:
You can't use any script for trailing. It undermines the very idea of what I am trying to tell you.
I'll write later on the computer.
The general line is the same: we only use functions. I will write how later.
That's how we use functions in the script too, Vasiliy. Yes, it is less convenient than in the Expert Advisor, but Vladimir implements the plan of self-learning. It's not desirable to deviate from it, because you may completely confuse the objectives and the material. Therefore, I supported his desire to make trailing in the script, even though it's not very correct.
 
MrBrooklin:

Got it, Vassili! I'll put everything on hold then.

Respectfully, Vladimir.

There is no fundamental difference where to write trailing functions, the main thing is to write and learn.
 
Реter Konow:
There is no fundamental difference where to write trailing functions, the main thing is to write and learn.

You cannot call OnTick in the script)

 
MrBrooklin:

Got it, Vassili! I'll put everything on hold then.

Respectfully, Vladimir.

Let's approach trailing step by step. Now I propose you to write the trailing algorithm on paper: i.e. make a detailed ToR, point by point, without a code of how it should work in your opinion. We will work with this in the future.
 
Valeriy Yastremskiy:

You cannot call OnTick in the script)

He wasn't going to. It would have blocked the script thread and would have been forever looping through the trading environment. I mean, it would do it all at once in a brutal way.
 
Vladimir Simakov:

There's an observation that once you start crunching, it's hard to stop, and as a consequence, the project code turns into what's known as d.c.

Let me explain:

  1. You have a project with an intermediate working solution and the number of implemented features counts=0.
  2. Our task is to implement the ++count feature.
  3. To add the features we need:
    • to write methods of object tree and connect all these things to event handlers with logic (estimated time 3 hours *count; count=0).
    • write a crutch in the form of global variable and use it in several methods, where we need it (estimated time 15 min *count.).
  4. Autonumbering bug (this is a bug report for meta-quotes).
  5. Naturally, we have chosen a crutch (it's really hard to make ourselves work in this case)
  6. if (we did it) goto 2
  7. else everything goes to hell, shouting help-mi and reading hilarious comments that it's wrong to do that.

I hope you paid attention to the fact, that the counter of implemented features, increases time of implementation of the next feature, but when implemented correctly, it resets to zero?

This is a very exaggerated idea, but that's how it works in real life.

What I mean is if you don't rewrite the project after you implement all the features it will go into production as an unreadable spoiler. And then, the life cycle of any project leads to a headache for the management: either to put the entire team on a global refactoring of all the things they have spun (and the competitors don't sleep, they, evil guys, write new features), or keep writing crutches and patching bugs, leaking in torrents.

Regulation and regulation again. And for violations, excommunication)))) and in a monolithic procedure everything can be implemented too )))).

Although, ok, I agree, all the former can still be, but new workers in the rules is an extra cost).

And to be honest, of course, after having more than 3-5 different data sources and more than 3 different processing algorithms, global variables without a clear regulation of their declaration is evil.

At runtime, all computational variables are globally declared. After processing, you can wrap them in anything you like)

 
Valeriy Yastremskiy:

Regulation and regulation again. And for infringements, excommunication))))) and in a monolithic procedure everything can also be implemented))))

Although, I agree, all the former can still be done, but it is too expensive to put new employees into the procedure)

That's why it's easier / easier / cheaper to train newly arrived fighters command "globals is evil" - tears, self-shooting, anger of older comrades immediately diminish order. And complex features through the globals beginners still do not need.
 
Vasiliy Sokolov:
He wasn't going to. He would have blocked the flow of the script and in an eternal loop would have jerked the trading environment. That is to say, it would do it all at once in a brutal way.

This is what I imagined, but only with Sleep function in the script and possibility to set sleep period from 1 to 10 seconds.

Respectfully, Vladimir.

Reason: