Compilation Problem: Is it related to the Robot or MetaEditor?

 

Message for the developers

Hi,

I’m having trouble solving a problem, and I can't figure out the reason (I'm not a coder).

I had a trading robot developed on this site.

I compiled it: 0 errors. The robot worked normally.

But, to my surprise, some time later, the robot showed 103 errors after compilation!

I thought it might be due to using an outdated version of MetaEditor. I downloaded the latest version and updated my MetaEditor.

But the problem remained the same: 103 errors.

So, where could the errors be coming from?

  • The robot?
  • MetaEditor?
  • Both?

I’m providing an excerpt of these errors below.


THANK YOU IN ADVANCE FOR YOUR RESPONSES!!





'SELECT_BY_POS' - undeclared identifier TradingRobot_010 (9).mq5 133 24
'OrderSelect' - wrong parameters count TradingRobot_010 (9).mq5 133 10
   built-in: bool OrderSelect(ulong) TradingRobot_010 (9).mq5 133 10
'OrderMagicNumber' - undeclared identifier TradingRobot_010 (9).mq5 134 10
')' - expression expected TradingRobot_010 (9).mq5 134 27
'OrderSymbol' - undeclared identifier TradingRobot_010 (9).mq5 135 9
')' - expression expected TradingRobot_010 (9).mq5 135 21
implicit conversion from 'unknown' to 'string' TradingRobot_010 (9).mq5 135 9
'OrderType' - undeclared identifier TradingRobot_010 (9).mq5 135 33
')' - expression expected TradingRobot_010 (9).mq5 135 43
'OrderProfit' - undeclared identifier TradingRobot_010 (9).mq5 136 16
')' - expression expected TradingRobot_010 (9).mq5 136 28
'OrderCommission' - undeclared identifier TradingRobot_010 (9).mq5 136 32
')' - expression expected TradingRobot_010 (9).mq5 136 48
'OrderSwap' - undeclared identifier TradingRobot_010 (9).mq5 136 50
')' - expression expected TradingRobot_010 (9).mq5 136 60
'SELECT_BY_POS' - undeclared identifier TradingRobot_010 (9).mq5 147 24
'OrderSelect' - wrong parameters count TradingRobot_010 (9).mq5 147 10
   built-in: bool OrderSelect(ulong) TradingRobot_010 (9).mq5 147 10
'OrderMagicNumber' - undeclared identifier TradingRobot_010 (9).mq5 148 10
')' - expression expected TradingRobot_010 (9).mq5 148 27
'OrderSymbol' - undeclared identifier TradingRobot_010 (9).mq5 149 9
')' - expression expected TradingRobot_010 (9).mq5 149 21
implicit conversion from 'unknown' to 'string' TradingRobot_010 (9).mq5 149 9
'OrderType' - undeclared identifier TradingRobot_010 (9).mq5 149 33
')' - expression expected TradingRobot_010 (9).mq5 149 43
'OrderType' - undeclared identifier TradingRobot_010 (9).mq5 150 13
')' - expression expected TradingRobot_010 (9).mq5 150 23
'OP_BUY' - undeclared identifier TradingRobot_010 (9).mq5 150 26
'OrderOpenPrice' - undeclared identifier TradingRobot_010 (9).mq5 151 56
')' - expression expected TradingRobot_010 (9).mq5 151 71
'OrderType' - undeclared identifier TradingRobot_010 (9).mq5 152 13
')' - expression expected TradingRobot_010 (9).mq5 152 23
'OP_SELL' - undeclared identifier TradingRobot_010 (9).mq5 152 26
'OrderOpenPrice' - undeclared identifier TradingRobot_010 (9).mq5 153 19
')' - expression expected TradingRobot_010 (9).mq5 153 34
'SELECT_BY_POS' - undeclared identifier TradingRobot_010 (9).mq5 167 24
'OrderSelect' - wrong parameters count TradingRobot_010 (9).mq5 167 10
   built-in: bool OrderSelect(ulong) TradingRobot_010 (9).mq5 167 10
'OrderMagicNumber' - undeclared identifier TradingRobot_010 (9).mq5 168 10
')' - expression expected TradingRobot_010 (9).mq5 168 27
'OrderSymbol' - undeclared identifier TradingRobot_010 (9).mq5 169 9

 
Jean Christophe Paput:
'SELECT_BY_POS' - undeclared identifier TradingRobot_010 (9).mq5 133 24

The code is for MT4, and you are trying to compile it with the MT5 terminal editor.

Use MT4 and its editor for that code.

 
Vladislav Boyko #:

The code is for MT4, and you are trying to compile it with the MT5 terminal editor.

Use MT4 and its editor for that code.

Thank you very much Vladislav  .

You're right . I have  only 5 errors with MT4

But is there again a problem between MT4 and MT5?


OrderCalcMargin and CopyBuffer are not part of MQL4; they belong to MQL5.


....


can't open "C:\users\chris\AppData\Roaming\MetaQuotes\Terminal\29FF6A555EE0C1299CC74E9104F718AF\MQL4\Include\TradeFunctions.mqh" include file TradingRobot_010 (9).mq4 5 11

'iATR' - wrong parameters count TradingRobot_010 (9).mq4 59 30

possible loss of data due to type conversion TradingRobot_010 (9).mq4 59 29

'iMA' - wrong parameters count TradingRobot_010 (9).mq4 60 32

possible loss of data due to type conversion TradingRobot_010 (9).mq4 60 31

'OrderCalcMargin' - function not defined TradingRobot_010 (9).mq4 575 8

'CopyBuffer' - function not defined TradingRobot_010 (9).mq4 584 15

5 errors, 2 warnings 6 3

;

 
Jean Christophe Paput #:
OrderCalcMargin and CopyBuffer are not part of MQL4; they belong to MQL5.

Judging by the file name, I can assume that this is version 10. Perhaps you previously added MQL5 code to the existing MQL4 code.

Jean Christophe Paput:
I compiled it: 0 errors. The robot worked normally.

Take the code that previously worked fine and compile it for MT4


The problem with TradingRobot_010 is that it is a mix of MQL4 and MQL5 code. A mix of MQL4 and MQL5 code cannot be compiled without errors anywhere.
 
Vladislav Boyko #:

Judging by the file name, I can assume that this is version 10. Perhaps you previously added MQL5 code to the existing MQL4 code.

Take the code that previously worked fine and compile it for MT4


The problem with TradingRobot_010 is that it is a mix of MQL4 and MQL5 code. A mix of MQL4 and MQL5 code cannot be compiled without errors anywhere.

Thank you for your response.

What surprises me is that when I initially compiled the mq5 source code, I got 0 errors. This is why I wonder if the new errors are due to the robot or MetaEditor. I mean, maybe it's the latest updates to MetaEditor that are causing these errors