Download MetaTrader 5

Multicore - Parallel calculation, multithread EA to speedup backtests.

To add comments, please log in or register
TradeNzt
157
TradeNzt  
Hi all community, i developed an EA and need to speedup backtests. I coded using classes and functions, i call them from main EA but i don't have speedup results (speed ramain the same by using only functions with no inclusion of classes). Backtest (with no optimizations) still run on a single core. I was wondering to run it in Multi Core and improve all cores performances. Is that possible? can someone explain a simple way? thanks a lot.
Stanislav Korotky
22873
Stanislav Korotky  
tradenzt:
Hi all community, i developed an EA and need to speedup backtests. I coded using classes and functions, i call them from main EA but i don't have speedup results (speed ramain the same by using only functions with no inclusion of classes). Backtest (with no optimizations) still run on a single core. I was wondering to run it in Multi Core and improve all cores performances. Is that possible? can someone explain a simple way? thanks a lot.

Of course, you can't run a single test on multiple cores because this is a sequential process. Every single tick/bar should be processed after all preceding ones in their respective order. This can not be executed in parallel.

TradeNzt
157
TradeNzt  
Stanislav Korotky:

Of course, you can't run a single test on multiple cores because this is a sequential process. Every single tick/bar should be processed after all preceding ones in their respective order. This can not be executed in parallel.


That's ok, but partially correct and does not answer to the question :-) , of course ticks are processed sequentially by OnTick() event handler, but suppose that i have 10 operations to do every single tick... can i dispatch those 10 operations on different threads? (one operation--> on thread...)    ....  one way could be call scripts; scripts are executed on separated thread, but i don't think is possible to call script from EA, what is possible to do is call functions included in classes (i done it but doesn't increase performances and ea still work on a single core).

Stanislav Korotky
22873
Stanislav Korotky  
Edoardo Pietro Fiamingo:

That's ok, but partially correct and does not answer to the question :-) , of course ticks are processed sequentially by OnTick() event handler, but suppose that i have 10 operations to do every single tick... can i dispatch those 10 operations on different threads? (one operation--> on thread...)    ....  one way could be call scripts; scripts are executed on separated thread, but i don't think is possible to call script from EA, what is possible to do is call functions included in classes (i done it but doesn't increase performances and ea still work on a single core).

MQL does not support parallelism inside. You have no means to run multiple functions of the same EA/script on separate threads/cores.

Sabil Yudifera
23379
Sabil Yudifera  
Christian Peters
629
Christian Peters  

If you do not plan to distribute your EA on the market, you could create a custom .dll file (in c++ for instance) that will handle the parallelism.

In MQL you can import the .dll file and use it as a library.

TradeNzt
157
TradeNzt  
Christian Peters:

If you do not plan to distribute your EA on the market, you could create a custom .dll file (in c++ for instance) that will handle the parallelism.

In MQL you can import the .dll file and use it as a library.

i've read about that but how to call dll from ea? in every case i don't know if is useful cause i can't perform orders from c++ ... or i can?
TradeNzt
157
TradeNzt  
Sabil Yudifera Daeng Pattah:
see this https://en.wikipedia.org/wiki/Hyper-threading
i already enabled but it's not enought
Sabil Yudifera
23379
Sabil Yudifera  
TradeNzt:
i already enabled but it's not enought

you can use a server computer with multiple processors.

example one computer has 100 processors

TradeNzt
157
TradeNzt  
Sabil Yudifera Daeng Pattah:

you can use a server computer with multiple processors.

example one computer has 100 processors


please read the question before answering :-)

TradeNzt
157
TradeNzt  
Christian Peters:

If you do not plan to distribute your EA on the market, you could create a custom .dll file (in c++ for instance) that will handle the parallelism.

In MQL you can import the .dll file and use it as a library.


did you tried? if yes did you had all cores working in single test? (not optimization)

12
To add comments, please log in or register