Time is more or less clear, but the variables for "Enough patience" are still a problem. What to put in them? Is there patience or no patience? At least these two parameters? I need to think about it.
Regards, Vladimir.
Formalizing the attributes is a complicated task. The easiest solution is to have patience or not. It is a little more difficult to gradate for example from 0 to 10. Assess your patience from 0 to 10. Rate your motivation from 0 to 5. Evaluate your memory from 0 to 10. Then we pass these variables into a function and add them up (for example) and compare it to 18 If more, the function returns True, if not, it returns False)
formalising features is a difficult task. The easiest solution is to have patience or not. A slightly more complicated grading is for example from 0 to 10. Rate your patience from 0 to 10. Rate your motivation from 0 to 5. Assess your memory from 0 to 10. Then we pass these variables into a function and add them up (for example) and compare it to 18. If more, the function will return True, if not, then False)
Thanks, Valery, for the tip! Frankly speaking, I got very distracted from the self-study plan and had to switch to the script with "Enough_time" and "Enough_patience" variables. I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
Is it possible to write a trailing stop loss script or is it possible with an Expert Advisor only?
Is it possible to avoid using include files and classes when writing the script?
Thanks, Valery, for the tip! To be honest, I got distracted from the self-study plan and had to switch to the script with "Enough_time" and "Enough_patience" variables. I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
Is it possible to write a trailing stop loss script or is it possible with an Expert Advisor only?
Is it possible to avoid using include files and classes when writing the script?
Sincerely, Vladimir.
Trailing function is more complicated than the "patience_enough" script. To write it by yourself you need understanding and experience, which you haven't gathered yet. You can, of course, start learning from ready-made code, but it's much better to "mature" to implement it yourself.
Trailing function includes a set of conditions, loops, error checks and other things, which you haven't tried to work with in practice.
Thanks, Valery, for the tip! To be honest, I got distracted from the self-study plan and had to switch to the script with the variables "Enough_time" and "Enough_patience". I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
Is it possible to write a trailing stop loss script or is it possible with an Expert Advisor only?
Is it possible to avoid using include files and classes when writing the script?
Sincerely, Vladimir.
1. Script no, Expert Advisor yes. The script is started right away and unloaded when it is finished. The OnTick function cannot be used in the script. Theoretically, you can. In the script, you can use SLEEP, the function to stop working for a while, and in the infinite loop vail at intervals to request the Ask price, compare it with the price of the position and change the SL and TP. Trading functions are not prohibited. But it is .... You will never be understood.
The script is a one-off operation, close all positions. Or open positions already with SL and TP and that's it. Remove all objects from the chart.
And the EA starts to work again with every tick.
2. It is possible, and it should be done in short. It is impossible to do without functions if the Expert Advisor has more than 2 actions.
The include files are a matter of code convenience, you don't have a single piece, but 2 separate windows that you can place under each other)
When compiling, the include file is simply inserted where the inlude stands. So compiled files will not differ.
And classes are wrappers of methods and functions, besides with rather complicated syntax. Therefore, a little later is better.
Thanks, Valery, for the tip! To be honest, I got distracted from the self-study plan and had to switch to the script with the variables "Enough_time" and "Enough_patience". I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
Is it possible to write a trailing stop loss script or is it possible with an Expert Advisor only?
Is it possible to avoid using include files and classes when writing the script?
Sincerely, Vladimir.
1. the trawl is constantly monitoring and trawling, so it' s a robot. Or maybe you can use some kind of looped script, and some smart guys will come running... :-)
2. it's possible.
IMHO, looking at this topic myself re-read.... :-)
don't forget the "basic" articles... :-) which help to understand the subject better than just plain code.
Советник модифицирует Стоп лосс у прибыльных позиций (выполняет Трейлинг). Применяется для всех позиций в терминале - нет никаких фильтров и ограничений по символам или по Magic number. TrailingStop Pips Or Points...
1. the trawl is constantly monitoring and trawling, so it's a robot. Or there could be some kind of looping script, the smart guys will come running... :-)
2. it's possible.
IMHO, looking at this topic myself re-read.... :-)
don't forget the "basic" articles... :-) which help to understand the subject better than just plain code.
But there's no point. Traylig should be a function. It is not self-sufficient to exist separately from the code of the whole EA.
Peter, if you remember, script New7.mq5 can already place pending orders, Take Profit and Stop Loss. I was going to add trailing stop loss to it according to the self-study plan. Hence the question. Thank you for the tip!
Is it possible to write a trailing stop-loss script at all, or is it only possible with an EA?
Is it possible to write a script without using include files and classes?
Sincerely, Vladimir.
Hello! You may write it and you may need it. Let's start with understanding what a trailing stop is, it's the change of the so-called dragging of the stop loss that occurs with every new tick and depending on the set distance from the current price. There are many types and methods, and you can find examples of incremental or one-off dragging of stops, which are used depending on the purpose. And you can decide if you want to use them or not.)
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Time is more or less clear, but the variables for "Enough patience" are still a problem. What to put in them? Is there patience or no patience? At least these two parameters? I need to think about it.
Regards, Vladimir.
Formalizing the attributes is a complicated task. The easiest solution is to have patience or not. It is a little more difficult to gradate for example from 0 to 10. Assess your patience from 0 to 10. Rate your motivation from 0 to 5. Evaluate your memory from 0 to 10. Then we pass these variables into a function and add them up (for example) and compare it to 18 If more, the function returns True, if not, it returns False)
formalising features is a difficult task. The easiest solution is to have patience or not. A slightly more complicated grading is for example from 0 to 10. Rate your patience from 0 to 10. Rate your motivation from 0 to 5. Assess your memory from 0 to 10. Then we pass these variables into a function and add them up (for example) and compare it to 18. If more, the function will return True, if not, then False)
Thanks, Valery, for the tip! Frankly speaking, I got very distracted from the self-study plan and had to switch to the script with "Enough_time" and "Enough_patience" variables. I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
Thanks, Valery, for the tip! To be honest, I got distracted from the self-study plan and had to switch to the script with "Enough_time" and "Enough_patience" variables. I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
Thanks, Valery, for the tip! To be honest, I got distracted from the self-study plan and had to switch to the script with the variables "Enough_time" and "Enough_patience". I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
1. Script no, Expert Advisor yes. The script is started right away and unloaded when it is finished. The OnTick function cannot be used in the script. Theoretically, you can. In the script, you can use SLEEP, the function to stop working for a while, and in the infinite loop vail at intervals to request the Ask price, compare it with the price of the position and change the SL and TP. Trading functions are not prohibited. But it is .... You will never be understood.
The script is a one-off operation, close all positions. Or open positions already with SL and TP and that's it. Remove all objects from the chart.
And the EA starts to work again with every tick.
2. It is possible, and it should be done in short. It is impossible to do without functions if the Expert Advisor has more than 2 actions.
The include files are a matter of code convenience, you don't have a single piece, but 2 separate windows that you can place under each other)
When compiling, the include file is simply inserted where the inlude stands. So compiled files will not differ.
And classes are wrappers of methods and functions, besides with rather complicated syntax. Therefore, a little later is better.
Thanks, Valery, for the tip! To be honest, I got distracted from the self-study plan and had to switch to the script with the variables "Enough_time" and "Enough_patience". I'll get back to it, but as I wrote - a little later. At this moment I had just begun to work out an algorithm for trailing Stop Loss. I am reading literature, browsing the website, but still cannot find answers to two questions related to MQL5 programming language:
1. the trawl is constantly monitoring and trawling, so it' s a robot. Or maybe you can use some kind of looped script, and some smart guys will come running... :-)
2. it's possible.
IMHO, looking at this topic myself re-read.... :-)
don't forget the "basic" articles... :-) which help to understand the subject better than just plain code.
Introduction to MQL5: Writing a Simple Expert Advisor and Indicator
Peter, I completely agree with your point of view, but I would still like to know the answers to my questions:
1. the trawl is constantly monitoring and trawling, so it's a robot. Or there could be some kind of looping script, the smart guys will come running... :-)
2. it's possible.
IMHO, looking at this topic myself re-read.... :-)
don't forget the "basic" articles... :-) which help to understand the subject better than just plain code.
Introduction to MQL5: Writing a Simple Expert Advisor and Indicator
Thank you, Roman, for your reply and the link to the basic articles!
Sincerely, Vladimir.
1. Yes.
Peter, if you remember, script New7.mq5 can already place pending orders, Take Profit and Stop Loss. I was going to add trailing stop loss to it according to the self-study plan. Hence the question. Thank you for the tip!
Regards Vladimir.
Hello! You may write it and you may need it. Let's start with understanding what a trailing stop is, it's the change of the so-called dragging of the stop loss that occurs with every new tick and depending on the set distance from the current price. There are many types and methods, and you can find examples of incremental or one-off dragging of stops, which are used depending on the purpose. And you can decide if you want to use them or not.)