
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
In the future, according to the self-study plan, the task is to modify the script step by step, namely:
Of course, you should not have followed the tutorial advice. You may have got the knowledge how to set lines, orders, etc., but you won't be able to develop the strategy anyway, because you haven't got the theoretical base. All these lines and scripts will not help you to understand basic programming stuff, and you cannot go far without it. I spent the first 4 months just learning, not even trying to write anything. Of course I could have brazenly, like you, but the quality of such knowledge is poor. There are always gaps in the basics, which will have to be filled in the future...
Hello, Peter! I study the textbook as needed, i.e. when I see a gap in my knowledge. Now, I feel that I will have to take a little pause and study the textbook more closely. All recommendations from forum participants are taken into account and I'm trying to stick to them. And now I'm amazed that I have managed to write something using only MQL5 Reference book for such a short time.
Regards, Vladimir.
Good evening to all and good mood!
I am pasting a new script New6.mq5 that helps you place one SellStop and one BuyStop pending order with a fixed lot size at a certain distance from the current price on the current chart. In this script, I tried to describe everything as I promised earlier, in clear and understandable form for a 1st grade programmer.
I used the information taken from the MQL5 Reference only when writing the script!
Best regards, Vladimir.
It's a good example. I suggest using it as a starting point. Basics.
In the future, according to the self-study plan, the task is to modify the script step by step, i.e:
No, no. Do not connect the new functionality yet. Now improve the existing logic. At the same time, get rid of the problems in the script implementation (they are already showing). If you want to know what to rewrite, I'll tell you.
The example is a good one. I suggest using it as a starting point. Baseline.
No, no. Don't plug in any new functionality just yet. Now improve the existing logic. At the same time get rid of problems in script implementation (they are already showing). What exactly you need to rewrite, if you will be interested, I'll tell you.
Hello Vasily! Of course, tell me what you need to rewrite, it would be interesting to me!
Sincerely, Vladimir.
Hello Vasily! Of course tell me what you need to rewrite, I'm very interested!
Sincerely, Vladimir.
Programmers have two problems: errors produced by the compiler and architecture problems. While you are a novice, you concentrate on fighting with the compiler while your ultimate goal is a program that works correctly. However, very quickly a beginner's program turns into so-called spaghetti code, which the author himself can't figure out soon enough. That's why I suggest that you focus not on the compiler and correctness of the final script but on architectural issues. It is like learning to play the piano: first you learn how to hold fingers correctly and sit at the instrument properly, no one demands playing Bach from a beginner.
You have two groups of parameters which determine the behavior of your script: the first is set statically, as a macro. The second is set by the user when loading the script on the chart. Now the user will not be able to select the type of the order to be placed without recompiling this script. This is not good. Therefore, it would be better to abandon these macros in favor of the additional parameter:
Accordingly, we have defined a new enumeration, which we have implemented as a selection parameter for the user.
Programmers have two problems: compiler errors and architecture problems. While you are a beginner, you focus on fighting the compiler, and your ultimate goal is a program that works correctly. However, very quickly a beginner's program turns into so-called spaghetti code, which the author himself can't figure out soon enough. That's why I suggest that you focus not on the compiler and correctness of the final script but on architectural issues. It is like learning to play the piano: first you learn how to hold fingers correctly and sit at the instrument properly, no one demands playing Bach from a beginner.
You have two groups of parameters which determine the behavior of your script: the first is set statically, as a macro. The second is set by the user when loading the script on the chart. Now the user will not be able to select the type of the order to be placed without recompiling this script. This is not good. Therefore, it would be better to abandon these macros in favor of the additional parameter:
Accordingly, we have defined a new enumeration, which we have implemented as a selection parameter for the user.
Great, in fact, you have prompted me what is written in step 4 of the step-by-step modification of the script, namely to expand the selection of pending orders.
Thank you!
Regards, Vladimir.
The next problem with your code is that it sprawls out into a long procedural sheet. All beginners write this way. And this is a problem that stays with them for years. Learn to break your algorithm into parts, starting from the basics like this script. There are two ways to do this: through functions and classes. The concept of classes is too difficult to grasp at first, so I suggest you focus on working with functions. Think about the importance of functions:
The next problem with your code is that it sprawls out into a long procedural sheet. All beginners write this way. And this is a problem that stays with them for years. Learn to break your algorithm into parts, starting from the basics like this script. There are two ways to do this: through functions and classes. The concept of classes is too difficult to grasp at first, so I suggest you focus on working with functions. Think about the importance of functions:
Thank you, Vasily for such a comprehensive advice. I will certainly take it into account and try to do my best.
Regards, Vladimir.
The next problem with your code is that it sprawls out into a long procedural sheet. All beginners write this way. And this is a problem that stays with them for years. Learn to break your algorithm into parts, starting from the basics like this script. There are two ways to do this: through functions and classes. The concept of classes is too difficult to grasp at first, so I suggest you focus on working with functions. Think about the importance of functions:
Vasily, the man has not even mastered arrays yet. It is too early for him to listen to such lectures).
Peter, all constructive advice is important to me, including yours!
Regards, Vladimir.