How do you create a function asynchronous without to do call OnTimer?

 

I would like to create an asynchronous function which will be used in my library.

But I don't want to use the OnTimer function!

If possible, how do you do that?

Thanks

 

Your use of "asynchronous" is wrong. It means start something and return immediately; the result happens later independent of the current running code. There is only one in MT5 (OrderSendAsync.)

Call your code, either periodically (OnTimer) or when price changes (OnTick) or when the user does something on the chart (OnChartEvent) or MT5: trades (OnTrade/OnBookEvent)
          MQL5 programs / Program Running - Reference on algorithmic/automated trading language for MetaTrader 5

 
William Roeder:

Your use of "asynchronous" is wrong. It means start something and return immediately; the result happens later. There is only one in MT5 (OrderSendAsync.)

Call your code, either periodically (OnTimer) or when price changes (OnTick) or when the user does something on the chart (OnChartEvent) or MT5: trades (OnTrade/OnBookEvent)
          MQL5 programs / Program Running - Reference on algorithmic/automated trading language for MetaTrader 5

Please, let me explain myself better ... I want to create a function equivalent to that of OnTimer(), to execute it cyclically and very quickly in order to make various calls to functions found in my C # DLL via Export without freeze CPU.


Is it possible?
 
Fabiano:

Please, let me explain myself better ... I want to create a function equivalent to that of OnTimer(), to execute it cyclically and very quickly in order to make various calls to functions found in my C # DLL via Export without freeze CPU.


Is it possible?

Create a worker EA that listens for custom chart events. Use that EA to call your DLL then send the response back to your Master EA using the custom chart event. You will need two charts running two separate EAs for that to work. 

 
Fabiano: let me explain myself better ... I want to create a function equivalent to that of OnTimer(), to execute it cyclically
Why? OnTick has not been called, nothing has changed. What are you going to do next time that you haven't done this time?
 

Thanks guys;)

I've been working on this wrapper project for a long time and it may sound weird but I came to the same conclusion like you;)

My wrapper works perfectly on different professional platforms such as: Visualchart, Mabus, Difon... and I'm blocking on Metatrader regarding a multithreaded function.

The function must communicate permanently with an unmanaged Dll to request different information.

I have several constraints such that I don't want to use OnTimer, OnStart, OnTick (...).

Ideally, I would like a function like "BackgroundWorker".

Is it possible in MQL?

Thank you in advance for your help.

 
Fabiano:

Thanks guys;)

I've been working on this wrapper project for a long time and it may sound weird but I came to the same conclusion like you;)

My wrapper works perfectly on different professional platforms such as: Visualchart, Mabus, Difon... and I'm blocking on Metatrader regarding a multithreaded function.

The function must communicate permanently with an unmanaged Dll to request different information.

I have several constraints such that I don't want to use OnTimer, OnStart, OnTick (...).

Ideally, I would like a function like "BackgroundWorker".

Is it possible in MQL?

Thank you in advance for your help.

All (or almost) is possible in MQL.

Is it an mql5 topic or mql4 ?

 
Alain Verleyen:

All (or almost) is possible in MQL.

Is it an mql5 topic or mql4 ?

Thanks Alain,

I would like create the Backgroundworker function in MQL4 language.

Thank you for your help

 
Fabiano:

Thanks Alain,

I would like create the Backgroundworker function in MQL4 language.

Thank you for your help

Didn't you already got an answer ?

mql doesn't have direct multi-threading functions, but you can do it with several EAs communicating between them.

In mql5 you could also use a Service.

 
Alain Verleyen:

Didn't you already got an answer ?

mql doesn't have direct multi-threading functions, but you can do it with several EAs communicating between them.

In mql5 you could also use a Service.

Thank's Alain, In my case I would like to use a library compiled with a Timer equivalent to OnTimer.

First of all, I already tried the export method from the library and thus recover the OnTimer. Only, this adds an extra layer to my heavy communication process between MQL and C#.

Obviously, NQuotes would have found it in its API since it does not use the OnTimer. But I don't know how they do it!

Reason: