Very useful. Thanks.
Steven
Thank you for this article, very helpful.
Mora
Yes, this article is very useful, but an "update" for MT5 build 684 is required. When I tried to use this program (especially the sub-program: "sample_trailingstop.mqh"), I received the error message: "attempt to connect by terminal of old build 674". I.e., the new update obviously requires a different format for orders.
Can anyone help? I need it desperately!
Thanks in advance!
L. Funderburk
Yes, this article is very useful, but an "update" for MT5 build 684 is required. When I tried to use this program (especially the sub-program: "sample_trailingstop.mqh"), I received the error message: "attempt to connect by terminal of old build 674". I.e., the new update obviously requires a different format for orders.
Can anyone help? I need it desperately!
Thanks in advance!
L. Funderburk
Hi locan.BBS,
I don't understand, what kind a help you're looking for ?, just update to 684 or re -install MT5 will update MT5 to 684.
Hi locan.BBS,
I don't understand, what kind a help you're looking for ?, just update to 684 or re -install MT5 will update MT5 to 684.
Thanks, onewithzachy!
Soon afterwards, I discovered that a defective "Strategy Tester" is/was at fault. Now the "SAR_trailing" EA is working.
But unfortunately my entries are even before the SAR line takes effect. Thus price can slip lower (or higher when shorting) at the beginning and never trigger the SAR alarm. (In accordance with the old rule: "The market can stay overbought(/sold) longer than you can stay solvent!")
That seems to make it more or less useless for me, since one of the biggest problems in counter-trend trading is signal failure in cascading markets. If your EA is working all the time, you will obviously have to deal in countertrends, too, which is dangerous if you don't have a universal SL.
So I have decided to try the NRTR method.
But unfortunately there seems to be a REAL PROBLEM with the file "my_first_NRTR_trailing", as even with the original file (without my modifications) a "trailing error" is immediately triggered, while this is not the case with the "SAR_trailing" counterpart. I am using the exact same program which works with the "SAR" variation, with just the few specific modifications at the beginning for "NRTR". What could be the problem there and what can a "newbie" do about it?
Thanks in advance for your (or other) sage advice!
L. Funderburk
Hi, I'm very new to the MQL5 community so please bear with me. How do I get this expert adviser to run in MT5? Is it possible or does it have copy rights?
Regards
Pine
Hi, I'm very new to the MQL5 community so please bear with me. How do I get this expert adviser to run in MT5? Is it possible or does it have copy rights?
Regards
Pine
Hello,
You can use it without problem. See the documentation to learn how to run an expert advisor.
I have been using the SAR trailing stop according to your program for several years, but I find that it no longer fits my requirments. So I want to try the NRTR method, which I hadn't installed before, by just changing the include call parameters in my EA. Everything else I am doing just as before.
But I am getting the following error message:
'fabct1cN.mq5' fabct1cN.mq5 1 1
'my_first_ea_nrtrtrailing.mq5' my_first_ea_nrtrtrailing.mq5 1 1
'Sample_TrailingStop.mqh' Sample_TrailingStop.mqh 1 1
'OnInit' - function already defined and has body fabct1cN.mq5 134 5
'OnTimer' - function already defined and has body fabct1cN.mq5 258 6
'OnDeinit' - function already defined and has body fabct1cN.mq5 265 6
'OnTick' - function already defined and has body fabct1cN.mq5 285 6
'Lot' - constant cannot be modified fabct1cN.mq5 480 4
'Lot' - constant cannot be modified fabct1cN.mq5 820 22
'Lot' - constant cannot be modified fabct1cN.mq5 820 37
'Lot' - constant cannot be modified fabct1cN.mq5 851 22
'Lot' - constant cannot be modified fabct1cN.mq5 851 37
possible use of uninitialized variable 'tm' Sample_TrailingStop.mqh 248 20
9 error(s), 1 warning(s) 10 2
Any suggestions would be greatly appreciated!
Thank you in advance!
Regards,
Locan.BBS
Thank you. Great article.
For who that are having problem with indicator nrtr: it's necessary download and compile the indicator, because it isn't a default one. Below, it follows the link: https://www.mql5.com/en/code/145

- votes: 20
- 2010.07.26
- Dmitry Fedoseev
- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article How to Create Your Own Trailing Stop is published:
The basic rule of trader - let profit to grow, cut off losses! This article considers one of the basic techniques, allowing to follow this rule - moving the protective stop level (Stop loss level) after increasing position profit, i.e. - Trailing Stop level. You'll find the step by step procedure to create a class for trailing stop on SAR and NRTR indicators. Everyone will be able to insert this trailing stop into their experts or use it independently to control positions in their accounts.
Author: Дмитрий