Questions from a "dummy" - page 75

 
kirill-demo:
I have created my Expert Advisor in Wizard. I do not know mql very well. Could you please explain me what to do by the example of envelopes?

The CSignalEnvelopes class does not have such a market model.

Conclusion: We need to improve the class (or write our own class).

 
What is the difference between calling functions from dll in MT4 and MT5? I compile dll, it works fine in MT5, but in MT4 it gives me error:

2011.10.06 23:00:34 Solaris executor EURUSDm,M1: cannot call function 'InfoOfTrading' from dll 'Solaris.dll' (error 127)

Документация по MQL5: Основы языка / Функции / Вызов функции
Документация по MQL5: Основы языка / Функции / Вызов функции
  • www.mql5.com
Основы языка / Функции / Вызов функции - Документация по MQL5
 
joo:
What is the difference between calling functions from dll in MT4 and MT5? I compile a dll, it works fine in MT5, but in MT4 it generates an error:

2011.10.06 23:00:34 Solaris executor EURUSDm,M1: cannot call function 'InfoOfTrading' from dll 'Solaris.dll' (error 127)

Give me a description of the function prototype, please. Most likely you used _stdcall design for MT5.

MT5 has a more flexible mechanism for linking DLL function names - it automatically supports both _stdcall (more advanced with name decoration) and _cdecl (old classic method). MetaTrader 4 only supports _cdecl calls.

Have you read the article"How to write a DLL for MQL5 and share data in 10 minutes?"It explains in detail how to call DLL functions.

 
Renat:

Provide a description of the function prototype, please. Most likely for MT5 you used _stdcall design.

MT5 has a more flexible mechanism for linking DLL function names - it automatically supports both _stdcall (more advanced with name decoration) and _cdecl (old classic method). MetaTrader 4 only supports _cdecl calls.

Read the article"How to write a DLL for MQL5 and exchange data in 10 minutes?" - there is a detailed description of DLL function calls.

Tried to declare it that way:

_DLLAPI void _cdecl InfoOfTrading(int &ou_ParamCountALl, int &ou_BarsRequired)

And so:

_DLLAPI void InfoOfTrading(int &ou_ParamCountALl, int &ou_BarsRequired)

instead of the old one:

_DLLAPI void __stdcall InfoOfTrading(int &ou_ParamCountALl, int &ou_BarsRequired)

But now a different error:

2011.10.07 01:35:05 Solaris executor EURUSDm,M1: function 'InfoOfTrading' call from dll 'Solaris.dll' critical error


I read the article.


In the settings of the project explicitly specified the way of calling:


And in MT5 still works without errors.

 
tol64:
In general, the signals are described in the Help in exactly the way you need them. You can see it here. The picture shows the settings of CCI indicator. Therefore, most likely, your Expert Advisor will not be based only on the signals of the Envelopes indicator. There is also CCI.

Right, sorry about that. I posted the wrong picture. But it doesn't change the matter. Here's a picture from the EA on envelopes only.

What do I do? How do I fix it?

 

By the way, in the surs example from standard MT4 delivery the call is made via __stdcall:

MT4_EXPFUNC double __stdcall GetDoubleValue(const double dpar)
  {
   printf("GetDoubleValue takes %.8lf\n",dpar);
   return(dpar);
  }

and it works fine.

 
Somebody explain it to me!!!
 
joo:

By the way, in the surs example from the standard MT4 delivery the call via __stdcall:

and it works fine.


In the MT4 example:

#define MT4_EXPFUNC __declspec(dllexport)

MT4_EXPFUNC char* __stdcall GetStringValue(char *spar)

и имена экспортируемых функций явно описываются через *.def файл:

LIBRARY ExpertSample

EXPORTS GetIntValue
        GetDoubleValue
        GetStringValue
        GetArrayItemValue
        SetArrayItemValue
        GetRatesItemValue
        SortStringArray
        ProcessStringArray


stdcall appears to be supported. I'm not sure it's correct to describe parameter passing via & for fours.
Документация по MQL5: Основы языка / Функции / Передача параметров
Документация по MQL5: Основы языка / Функции / Передача параметров
  • www.mql5.com
Основы языка / Функции / Передача параметров - Документация по MQL5
 
Renat:

The MT4 example:

#define MT4_EXPFUNC __declspec(dllexport)

MT4_EXPFUNC char* __stdcall GetStringValue(char *spar)

и имена экспортируемых функций явно описываются через *.def файл:

LIBRARY ExpertSample

EXPORTS GetIntValue
        GetDoubleValue
        GetStringValue
        GetArrayItemValue
        SetArrayItemValue
        GetRatesItemValue
        SortStringArray
        ProcessStringArray


stdcall turns out to be supported. I'm not sure if it's correct to describe parameter passing via & for the four.

I'm completely unlearned in two years with 4. :)

1. it turns out that a variable passed by reference cannot be written into a dll. You have to use an array for that.

2. and it is obligatory to use *.def file.

Here are actually 2 differences of working with 4's and 5's dlls that I discovered, there may be more.

 
Folks, sorry if this kind of question is already annoying, can you tell me how to correctly fill in the parameters>mail tab? I have mail on mails.ru, will it work? I do not know what is the address of the server there ... if not suitable, where to register a suitable? I want to do email notifications...
Reason: