
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
Good, but this is not real-time solution, because we can't control the time of response for non-tick events.
In case of "sleep()" we can.
So if we combine tick by tick and stale prices with sleep then we can have a real time clock :)
As i said, if this solution is implemented in an EA there is no need anymore for TimeCurrent() and the Loop is controlled by Sleep(Interval-Runtime) (in ms)
Most of the code stays the same, redraw() will not be needed anymore. Also if you need to increase speed of the code you can use some (ah im missing the english word) arrays with rotation zero point to get rid of the shift loop.
AFAIK this (or similar) is best solution which can be done in pure MQL in a indicator. There surely exist better solution when you use a DLL an export the calculations in an external program
So if we combine tick by tick and stale prices with sleep then we can have a real time clock :)
Yes, but Sleep is not possible in Indicators, thats your problem since the beginning of this thread
Can an EA call an indicator ?
You can attach a script to the chart that sends a fake tick every second to the chart. This is what I usually do to update multi-pair indicators and EAs in regular intervals.
You need a dll for that or is this possible without?
Its just a handful of lines in mql4 (of course you need DLL calls allowed to call the windows API, but you don't need to install anything):
I have this script in my favorites and when I need ticks I just drag it to the chart.
I also have a variation of this without the loop that only sends one tick and then exits and have bound this (one_tick.mq4) to hotkey ALT+T and now I can send a tick to the active chart by just pressing ALT-T. I need this for some of my stat-arb EAs when experimenting during the weekend to enforce start() to trigger their calculations and plotting of their graphs (I can move lines on the chart to change the interval and then I need a new tick to update their calculations).
nice one. thanks for sharing