Discussion of article "MQL5 Wizard: How to Create a Module of Trailing of Open Positions"

 

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.

Figure 1. Structure of the base class CExpert

Author: MetaQuotes

 

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

Пошаговое руководство по написанию MQL5-советников для начинающих
Пошаговое руководство по написанию MQL5-советников для начинающих
  • 2010.06.09
  • Samuel
  • www.mql5.com
Написание советников на MQL5 проще чем кажется, вы легко можете этому научиться. В этом руководстве вы познакомитесь с основными моментами, необходимыми для написания простого советника на основе конкретной торговой стратегии. Рассмотрена структура советника, использование встроенных технических индикаторов и торговых функций, вопросы отладки и тестирования советника на исторических данных.
 
It is necessary to rewrite the Expert Advisor as a trading signals module. Then any of the existing types of trailing can be easily connected to it.
Мастер MQL5: Создание эксперта без программирования
Мастер MQL5: Создание эксперта без программирования
  • 2010.12.15
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы хотите быстро проверить торговую идею, не тратя времени на программирование? Выберите в "Мастере MQL5" нужный тип торговых сигналов, подключите модули сопровождения позиций и управления капиталом - на этом вся работа закончена. Создайте свои реализации модулей или закажите их через сервис "Работа" - и комбинируйте новые модули с уже существующими.
 
Trolls:

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
Тема диверсификации активов на финансовых рынках стара, как мир и всегда привлекала к себе внимание всякого мало-мальски разбирающегося в этом деле трейдера. В данной статье автором предложен вариант максимально простого подхода для построения мультивалютного эксперта для первоначального знакомства с этим направлением торговых стратегий.
 
Trolls:

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.

 
uncleVic:

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...

 
Trolls:

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?

Как заказать торгового робота на MQL5 и MQL4
Как заказать торгового робота на MQL5 и MQL4
  • 2010.06.18
  • MetaQuotes Software Corp.
  • www.mql5.com
С запуском сервиса "Работа" MQL5.community становится идеальным местом для размещения заказов и оказания услуг программирования. Тысячи трейдеров и разработчиков ежедневно посещают этот ресурс и с легкостью могут помочь друг другу. Для трейдера сервис "Работа" - это легкая возможность получить свой собственный эксперт. Для MQL5-разработчика это возможность легко найти новых клиентов. В данной статье мы рассмотрим возможности этого сервиса.
 
maxxttro:

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).