You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The issue is the behind the scenes processing that the terminal does whenever OnTick is called which holds the thread until it is completed. So lets say a chart event comes in while OnTick is being called, what happens is OnTick called -> OnChartEvent wait for OnTick finish -> OnTick returns -> terminal does stuff -> now OnChartEvent is called.
Please read my latest post (edit). I get 150microseconds. You may download TimerTool and set the timer as you wish, or open a browser with a video site and the time will go down as well
I don't think you are understanding the challenge. We are not discussing anything about system timers. We are discussing the latency introduced into the EA thread from the behind-the-scenes terminal processing of the OnTick function. This EA demonstrates exactly what we are talking about.
I suppose the most efficient way to manage a multi-currency EA is to run the receiver entirely from the OnChartEvent function on an off-line chart?
Actually what is the initial reason the use Custom events ? What is the problem to run 1 EA trading multiple currencies ("perpetual loops") ?
MQL5 is easy, you just use OnBookEvent, but with MQL4 these perpetual loops are killing my processor (think AWS instance). So the solution (currently) is to drop the EA on a non-updating offline chart running in receive/calculate mode, and then the EA then opens up the live charts of subscribed symbols with clones running in send mode.
Actually what is the initial reason the use Custom events ? What is the problem to run 1 EA trading multiple currencies ("perpetual loops") ?
You know... you got me thinking... Perhaps it would be more efficient to run an OnTimer perpetual loop on an offline chart instead of having multiple charts doing OnTick. Also, the asynchronous orders could be managed in the OnChartEvent handler in other offline charts so OnTick will never interfere with operation, correct? Do you know where I can find code to programmatically open offline charts?
You know... you got me thinking... Perhaps it would be more efficient to run an OnTimer perpetual loop on an offline chart instead of having multiple charts doing OnTick. Also, the asynchronous orders could be managed in the OnChartEvent handler in other offline charts so OnTick will never interfere with operation, correct? Do you know where I can find code to programmatically open offline charts?
my 2 cents,
If you want to use MT4, you can use a single offline chart, and poll from there with OnTimer(), with a value of, say, 50ms. I can not remember MQL4, I guess one can use MarketInfo() or similar to get values of pairs from Market Watch. But, IIRC, MT4 does not have async orders
MQL5 is easy, you just use OnBookEvent, but with MQL4 these perpetual loops are killing my processor (think AWS instance). So the solution (currently) is to drop the EA on a non-updating offline chart running in receive/calculate mode, and then the EA then opens up the live charts of subscribed symbols with clones running in send mode.
Sorry but I still have no idea what you mean exactly by perpetual loops. I always use a timer and scan the different symbols, not a big deal. (Of course a tick event for each symbol would be nice).
If you want to use MT4, you can use a single offline chart, and poll from there with OnTimer(), with a value of, say, 50ms. I can not remember MQL4, I guess one can use MarketInfo() or similar to get values of pairs from Market Watch. But, AFAIK, MT4 does not have async orders
It does asyncronous orders as long as those orders are sent from separate EAs. For example...
You know... you got me thinking... Perhaps it would be more efficient to run an OnTimer perpetual loop on an offline chart instead of having multiple charts doing OnTick. Also, the asynchronous orders could be managed in the OnChartEvent handler in other offline charts so OnTick will never interfere with operation, correct? Do you know where I can find code to programmatically open offline charts?
Why an offline chart ? Just don't use OnTick()...ah maybe you are thinking there is an overheid on a normal chart even without using OnTick() ?
Asynchronous "like" orders can be done if you really need it, but in MT4 is it really worth it ? Well, depends of the strategy I suppose.