Discussion of article "Step-by-Step Guide to Writing an Expert Advisor in MQL5 for Beginners" - page 3

 

After some difficulties, the tester worked completely and produced results that coincide with the stated results in the article.

About the difficulties. History downloading took a very long time (55 minutes at 8 Mbps), with several interruptions, I had to restart the tester 2 times. In the end the tester froze. I closed MT 5, but could not open it again. I had to completely reboot the system. After that MT5 booted up quietly, and surprisingly, the tester worked completely (about 2 minutes) and gave all the results stated in the article (I specified the testing parameters exactly as stated in the article). And further testing on different timeframes went on without any problems.

Summary. The article is cool. The Expert Advisor is workable. I will dig further.

 
I wonder why ArraySetAsSeries calls are in the body of OnTick() and not OnInit() ?
Документация по MQL5: Операции с массивами / ArraySetAsSeries
Документация по MQL5: Операции с массивами / ArraySetAsSeries
  • www.mql5.com
Операции с массивами / ArraySetAsSeries - Документация по MQL5
 
Также это лучшее место для получения хэндлов технических индикаторов, которые будут использоваться (в нашем случае это индикаторы ADX and Moving Average).

Why not say in this place what is the handle of technical indicators?

What is it? An indicator identifier?

 
vas:

Why not say in this place what is the handle of technical indicators?

What is it? An indicator identifier?

Indicator handle is the identifier of the thread in which the indicator is calculated, calling the handle you address the data stream.

And the function that returns the handle creates (starts) this very thread. That's why developers do not recommend to access the stream immediately after its creation, as it may be still in the process of data calculation.

 

Greal article! Clearly structured and easily understood. 

 I doubt the return expression in the first "if" condition of the "OnInit()". Perhaps the parameter should be -1, whatever but not 0, or the if condition is redundant.

 

I tried to implement the expert from the article https://www.mql5.com/en/articles/100 on classes of the standard library.

I am posting what I got.

Unfortunately, the identical trade did not work, because the code from the article has errors.

The ExpertADX-MA.mq5 file should be placed in Experts\Advisors. -this is the Expert Advisor

TheSignalADX-MA.mqhfile should be placed in Include\Expert\Signal. - this is the class of trading signals.

The TrailingFixedPips.mqh file should be placed into Include\Expert\Trailing(with replacement). - it is a file from the standard delivery with some minor changes.

Expert.mqh file should be placed intoInclude\Expert (with replacement). -file from the std. file from the standard delivery with minor changes

The changes of the standard delivery will be made in the next build.

PS: Trawl is "screwed" in Expert (by request of workers).

To "unscrew" it, you need to comment the line:

      if(!ExtExpert.InitTrailing(new CTrailingFixedPips)) return(-3);

in the file ExpertADX-MA.mq5.

Пошаговое руководство по написанию MQL5-советников для начинающих
Пошаговое руководство по написанию MQL5-советников для начинающих
  • 2010.06.09
  • Samuel
  • www.mql5.com
Написание советников на MQL5 проще чем кажется, вы легко можете этому научиться. В этом руководстве вы познакомитесь с основными моментами, необходимыми для написания простого советника на основе конкретной торговой стратегии. Рассмотрена структура советника, использование встроенных технических индикаторов и торговых функций, вопросы отладки и тестирования советника на исторических данных.
Files:
 

Errors in the EA code in the article Step-by-Step Guide to Writing MQL5 Expert Advisors for Beginners have been corrected.

Please download the updated version of the Expert Advisor code.
 

In the above EA code.

Thedynamic array double maVal[] is declared in the global scope.

and not in the void OnTick() function area.

Suppose the Expert Advisor has been running for 24 hours.

Question: What will happen to the memory allocated for the dynamic array? How quickly will it be clogged with rubbish?

Or in other words, I will formulate the question: Does memory leakage occur in this case?

 

Thank you for you article !

 
I am very thankful for this article it has helped a great deal. After writing my codes for my EA I pressed the debugging button and i was told that I have 10 errors, in your article their isn't any information for correcting these errors. So how do I solve this problem, please write back as soon as possible ?