Please help me. how to use this code in an Expert Advisor. let's say this one https://www.mql5.com/en/articles/100.
I can't get this OOP in any way. help. show me how to insert this code or trawl into my EA. which is created without the help of a wizard. Thank you

- 2010.06.09
- Samuel
- www.mql5.com

- 2010.12.15
- MetaQuotes Software Corp.
- www.mql5.com
Please help me. how to use this code in an Expert Advisor. let's say this one https://www.mql5.com/en/articles/100.
I can't get this OOP in any way. help. show me how to insert this code or trawl into my EA. which is created without the help of a wizard. Thank you
"This code or trawl can't be inserted into your EA", taking into account that "there is no way this OOP is getting through".
The module of open positions maintenance is written taking into account the peculiarities of its (the module's) interaction with the CExpert class.
Theoretically, it is possible to write some software "layer", but it will require OOP knowledge and additional efforts.
it turns out that all standard classes are made only for their use in the Expert Advisor, which is obtained using the built-in generator....
bad, very bad, that these standard classes, the same algorithm for setting SL at no loss, can not be inserted, for example, in the code of Nikolay Kositsin https://www.mql5.com/en/articles/105 or in the Expert Advisor step-by-step guide https://www.mql5.com/en/articles/100.
It turns out that we need to write everything new, reinvent the wheel again when it is ready ((((
Those Expert Advisors are clear, and it is clear where to make changes there, and what it will lead to. But here it turns out to generate an Expert Advisor and sit and admire it ((, because the slightest change can lead to a crash, and it is not clear where and what can be made...a million questions

- 2010.06.30
- Nikolay Kositsin
- www.mql5.com
it turns out that all standard classes are made only for their use in the Expert Advisor, which is obtained using the built-in generator....
bad, very bad, that these standard classes, the same algorithm for setting SL at no loss, can not be inserted, for example, in the code of Nikolay Kositsin https://www.mql5.com/en/articles/105 or in the Expert Advisor step-by-step guide https://www.mql5.com/en/articles/100.
It turns out that we need to write everything new, reinvent the wheel again when it is ready ((((
Those Expert Advisors are clear, and it is clear where to make changes there, and what it will lead to. But here it turns out to generate an Expert Advisor and sit and admire it ((, because the slightest change can lead to a crash, and it is not clear where and what can be made...a million questions
It is impossible to create a class that can be used "for example here" or "let's say here". A class contains a set of interfaces that can be used in a specific way.
If you want to use an off-the-shelf "bicycle", you just put your feet on the pedals and pedal it (pedal).
If you want the "bicycle" to ride by clapping your hands or by voice command, then leave the ready-made one to those who pedal, and you will have to invent it.
It is impossible to create a class that can be used "for example here" or "let's say here". A class contains a set of interfaces that can be used in a DEFINITELY defined way.
If you want to use an off-the-shelf "bicycle", you just put your feet on the pedals and pedal it (pedal).
If you want the "bike" to go on a hand clap or voice command, then leave the off-the-shelf to those who pedal and you have to invent.
That's what I'm asking you to show me how to do... because a new bicycle can be assembled like a construction set of cubes and if you screw it all together correctly, it will go.
Why reinvent the wheel when there's one ready to go?
there are ready-made bicycles in the articles (EAs I gave a link to). help the user, show how to correctly screw the standard classes created by you to these EAs...
So I'm asking you to show me how to screw it on... because a new bike can be assembled like a construction set of cubes and if you screw it on correctly, it will go.
Why reinvent the wheel when there's one ready to go?
there are ready-made bikes in the articles (EAs I gave a link to). help the user, show how to properly screw the standard classes you created to these EAs...
Ok, I'll try to explain, but not "right now".
First, let's define exactly what "this code" you want to use in your EA.
Then, (I don't promise that it will be done as a priority) we will quietly solve your problems with bolting.
There is a oversight in code, if you open position with no SL, for short position CheckTrailingStopShort() won't change it.. (I set SL one bar after)
should be:
if(position.StopLoss()<=open&&position.StopLoss()!=0.0) return(false);
I guess good idea always use SL... Thanks for the article..
Hello dear friends.In my module of position maintenance I use a simple algorithm of closing a part of position and modification of stop to breakeven.Till not long ago the module worked but with new updates it doesn't work,can't initialise the function and is looking for some indicator though they are not there.When using the same Expert with other modules of the trawl such problem doesn't occur.The programmer who wrote this module said that it is necessary to address to you,it is connected something with updates.Please help to solve the problem.
2012.02.02 12:14:38 Core 1 tester stopped because OnInit failed.
Even if you generate an expert with the SampleTrailing.mqh module the same picture what to do?

- 2010.06.18
- MetaQuotes Software Corp.
- www.mql5.com
Hello dear friends.In my module of position maintenance I use a simple algorithm of closing a part of position and modification of stop to breakeven.Till not long ago the module worked but with new updates it doesn't work,can't initialise the function and is looking for some indicator though they are not there.When using the same Expert with other modules of the trawl such problem doesn't occur.The programmer who wrote this module said that it is necessary to address to you,it is connected something with updates.Please help to solve the problem.
2012.02.02 12:14:38 Core 1 tester stopped because OnInit failed.
Even if you generate an expert with SampleTrailing.mqh module the same picture what to do?
Not much information:
2012.02.02 12:14:38 Core 1 tester stopped because OnInit failed
Besides this message, there is something else in the log. Perhaps it is not the trawl module, but something else.
To understand it you need sources.
Put a request to servicedesk and attach the sources (they will "die" together with the request).

- 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 MQL5 Wizard: How to Create a Module of Trailing of Open Positions is published:
The generator of trade strategies MQL5 Wizard greatly simplifies the testing of trading ideas. The article discusses how to write and connect to the generator of trade strategies MQL5 Wizard your own class of managing open positions by moving the Stop Loss level to a lossless zone when the price goes in the position direction, allowing to protect your profit decrease drawdowns when trading. It also tells about the structure and format of the description of the created class for the MQL5 Wizard.
Author: MetaQuotes