Multi Threading

 
Is there anyway to get better performance out of MQL4?  Because of this language being single thread, it sometimes misses trades that are trying to be executed at the same time in my expert.  How do you do it?
 

Threads are controled by MT not by MQL4.

so......

mosttime, do not need, are you sure you need it ?

 
Buy a more powerful computer? Seriously, besides the complexity of your program logic, communication delay in the Internet and queueing/trade processing time at the broker side may take bigger portion of the total 'trade execution time'.
 
fireflies:
Buy a more powerful computer? Seriously, besides the complexity of your program logic, communication delay in the Internet and queueing/trade processing time at the broker side may take bigger portion of the total 'trade execution time'.


I was considering that. Most the time the program works great. I was first thinking about upgrading my proc so that it can simply execute this program faster. Nothing like MORE RAM, MORE POWER and then possibly multi threading.

 
jyett77 wrote >>
Is there anyway to get better performance out of MQL4? Because of this language being single thread, it sometimes misses trades that are trying to be executed at the same time in my expert. How do you do it?

hi, jyett77

u should know multi-thread program is easier to crash, when using some api, such as getCurrentDirectory, GetModuleFileName.etc

and u should use looping -"for" and pending order, to avoid missing chance of entering market~ ~

 

> it sometimes misses trades that are trying to be executed at the same time in my expert

1) Alter your code to handle order errors, so the the action can be repeated as needed

2) Split the heaviest EA's to their own copy of MT, so you get an additional and separate order thread

FWIW

-BB-

 
BarrowBoy:

> it sometimes misses trades that are trying to be executed at the same time in my expert

1) Alter your code to handle order errors, so the the action can be repeated as needed

2) Split the heaviest EA's to their own copy of MT, so you get an additional and separate order thread

FWIW

-BB-

Additionally - if you are receiving "Trade Context Busy" errors, then you should make use of the function IsTradeAllowed() within a condition statement immediately before submitting order requests.


CB

Reason: