Services. Are they up and running yet? - page 15

 
Igor Makanu:

HH: I don't know how to pass price[] into C#without copying - any options?

ArraySwap.

 
fxsaber:

ArraySwap.

Alas, it didn't work, compiler still traces const ( 'price' - constant variable cannot be passed as reference Momentum_DLL.mq5 57 17 )

Here are 2 calculation functions in C# oncalculate, one needs to pass by reference ( ref ) an array price, the second just passes an array as a parameter ( without ref ), I haven't managed to win without copying - I wrote in the MQL comment the function signature


Files:
 
Igor Makanu:

Alas, it didn't work, compiler still traces const ( 'price' - constant variable cannot be passed as reference Momentum_DLL.mq5 57 17 )

Here are 2 calculation functions in C# oncalculate , one pass by reference ( ref ) the price array, the second one just pass the array as a parameter ( without ref ), I haven't managed to win without copying yet - I wrote in the MQL comment of the function signature

ME shows no const in the signature.


 
fxsaber:

ME shows that there is no const in the signature.


Yes, that's right, it's a feature of C# to prohibit writing const in the signature

http://qaru.site/questions/672666/const-function-parameter-in-c

and the MQL feature is to forbid passing arrays by parameter, i.e. only by reference

Константный параметр функции в С#
  • 2012.06.11
  • TheLazyChap
  • qaru.site
Имея запрограммированный в С++ в прошлом, я помню, что мы могли бы сделать постоянный параметр reference/pointer в методе. Если моя память правильная, ниже указано, что метод не может изменить ссылку, а сама ссылка является постоянной...
 
Igor Makanu:

Yes, it is, it's a feature of C# to forbid writing const in the signature of a function

I probably don't understand it well, but this C# feature looks wild!

 
fxsaber:

Probably don't understand it well, but this feature of C# looks wild!

as the saying goes ... whatever you get for free, that's what you use ))))

Is there no way to "trick" the compiler with define or template to get rid of this limitation in MQL?

 
Igor Makanu:

Is there no way to "trick" the compiler with define or template to get away from this limitation in MQL ?

Asked a question.

 
Реter Konow :

The question is, can two-way communication be organised between the services and the advisor via resources?

If so, it is definitely a useful and useful thing!

You are absolutely right. It is possible with the current version, but you have to create some kind of dedicated solution. It would be nice to have a built-in solution for communication between EAs/indicators and services as well as between services. Renat knows this without a doubt.

Can't wait to see Metaquotes solution for these communication problems :-)

 
Alain Verleyen:

You are absolutely right. It is possible with the current version, but you should create some kind of special solution. It would be nice to have a built-in solution for communication between experts/indicators and services as well as between services. Renat knows this without a doubt.

I can't wait to see Metaquotes solution for these communication problems :-)

I have a solution for communication between EAs and indicators on MT5. I am testing it now. It is known that every trained coder can transfer data between their EAs and indicators via resources, but if we are talking about the development of a complex, multi-dimensional communication of MT5 programs as an integral part of modern algorithmic trading, we need a well thought-out and developed method of communication, implemented in a special "mediator", which coordinates the data flow. This is my topic and I am developing it. :)
 

With global variables of the terminal, you can transfer up to 8 bytes of information in one variable.

To differentiate access from different MQL5 programs, you can use GlobalVariableSetOnCondition

Reason: