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

 

Hello everyone,


has anyone here found a solution?


LG Georg

 
georgOBE:

Hello everyone,


Has anyone here found a solution?


LG Georg

For which problem exactly?

 
Carl Schreiber:

For which problem exactly?

When compiling I get this message twice:


return value of'OrderSend' should be checked my_first_ea.mq5 217 10


I use: the MetaEditor 5.00 build 2280

VG Georg



 

This is a hint, not a direct error.

How did you write the code for Order Send?

 
amando:

This is a hint, not a direct error.

How did you write the code for Order Send?

I downloaded the code 1 : 1 from the article, it was there "ready to go",


to the article: https: //www.mql5.com/de/articles/100

to the download: https://www.mql5.com/en/articles/download/100.zip

Schrittweiser Leitfaden für Anfänger zum Schreiben eines Expert Advisors in MQL5
Schrittweiser Leitfaden für Anfänger zum Schreiben eines Expert Advisors in MQL5
  • www.mql5.com
Dieser Beitrag richtet sich an Anfänger, die wissen möchten, wie man einen einfachen Expert Advisor (EA) in der neuen MQL5-Sprache schreibt. Beginnen wir also zunächst mit der Festlegung dessen, was unser Expert Advisor können, und sehen uns dann an, wie wir festlegen können, wie er dies ausführen soll. 1. Handels-Strategie Er überprüft einen...
 
georgOBE:

I downloaded the code 1 : 1 from the article, there it was "ready to go",


to the article: https: //www.mql5.com/de/articles/100

to the download: https://www.mql5.com/en/articles/download/100.zip

Such errors are obtained if the strict option is enabled:

To fully control all errors, it is recommended to use the strict compilation mode, which is specified with the following instruction:

#property strict

This mode simplifies debugging considerably.

(from: https://www.mql5.com/en/articles/1391)

The note shows you that the code does not 'react' and informs you if and why the execution of OrderSend has failed. This can be fatal if, for example, you want to close an existing position with a new order, but this does not happen and nothing and nobody tells you this!

Have a look at the documentation to see what a better version of OrderSend could look like.

What's New in MQL4
What's New in MQL4
  • docs.mql4.com
Starting from build 600, MQL4 programming language has been completely revised reaching the level of MQL5 - now you can develop trading robots in MQL4/5 using the unified MetaEditor development environment, single style, libraries and debugging tools. MQL4 is popular among automated system developers due to the ease of learning and a huge...
 
#property strict

has no effect in MQL5 and is obsolete.

Incidentally, the code of article 100 is not exactly the yellow of the egg either.

The many comments are very annoying, the system library 'Include\Trade\Trade.mqh' is not used.

@georgOBE: if this is really important to you, I will rewrite this EA

 
Otto Pauser:

has no effect in MQL5 and is obsolete.

Incidentally, the code of article 100 is not exactly the best of the best either.

The many comments are very annoying, the system library 'Include\Trade\Trade.mqh' is not used.

@georgOBE: if this is really important to you, I will rewrite this EA

I have programmed software for many years, unfortunately never in C++, the transition to MQL5 is not easy for me, I find the example very functional, I wanted to use it as an introduction, YES, I would be very grateful if you would do the work and make the FA executable

LG Georg

 
georgOBE:

I have programmed software for many years, unfortunately never in C++, the transition to MQL5 is not easy for me, I find the example very functional, I wanted to use it as an introduction, YES, I would be very grateful if you do the work and make the FA executable

LG Georg

Which language(s) did you programme in?

As an old Pascal freak, I didn't manage to get started in C for a long time, nor did I want to, but that was probably due to the Microsoft compilers.

MQL5 is as simple as Turbo Pascal was back then. Delphi was better, of course.

Yes, I'll do that and then post it here.

LG Otto

 
Otto Pauser:

Which language(s) did you programme in?

As an old Pascal freak, I didn't manage to get into C for a long time, and I didn't want to, but that was probably due to the Microsoft compilers.

MQL5 is as simple as Turbo Pascal was back then. Delphi was better, of course.

Yes, I'll do that and then post it here.

LG Otto

Hello Otto,

I took my first steps with TurboPascal, I was young and cool (or stupid?:-) ) and switched to assembler languages, that was all 25 years ago, privately I last dealt with PHP, Java, everything around WEB app languages, on the job for many years with MS-Fox-Pro and wrote database programs, back in mechanical engineering for over 10 years, so much for the CV :)


LG Georg