property strict directive

 

Hi,

I am getting the error " EX4 file must be compiled using #property strict directive" while uploading new version of EA to market for MT4.

How can I fix the problem?

Regards.

 

Just use it: #property strict

This will help you as it points at compile time to potential errors.

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Program Properties (#property) - Preprocessor - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Please don't post randomly in any section. Your question is not related to the section you posted.

MT4/mql4 has it's own section on the forum.

I have moved your topic to the correct section later, please don't create another topic.

 
Edwin Wanyoike Mumbi:

I am getting the error " EX4 file must be compiled using #property strict directive" while uploading new version of EA to market for MT4.

How can I fix the problem?

"How can you fix the problem?" Do exactly what it said, add strict and recompile.

Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.

 
Alain Verleyen #:

Please don't post randomly in any section. Your question is not related to the section you posted.

MT4/mql4 has it's own section on the forum.

I have moved your topic to the correct section later, please don't create another topic.

Sorry, I'm well guided.

 
William Roeder #:

"How can you fix the problem?" Do exactly what it said, add strict and recompile.

Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.

Thanks William, I have tried everything but am stuck!

 
Edwin Wanyoike Mumbi #: Thanks William, I have tried everything but am stuck!

Simply add ...

#property strict

... to the beginning of you code file, and then recompile.

However, you will probably get many new compile errors and warnings, which you will need to fix. Fix the warnings too.

 

Forum on trading, automated trading systems and testing trading strategies

#property strict errors

Fernando Carreiro, 2023.04.24 11:57

The "#property strict" imposes to updated and more "strict" rules of MQL4+ which are similar to MQL5 language rules, instead of the old MQL4.

You can read more about the updates of the updated MQL4 here ... Updated MQL4 - Language Basics - MQL4 Reference

EDIT: You should always fix "warnings", or you run the risk of skipping over a real bug disguised as a warning.