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
Thanks again for your outline.
I am using different symbols in two charts.
I understand your idea and method. My real work within OnTimer() includes open trades and close trades. It may take no time in case of no trade or long time to make several orders. It's difficult to manage the execution time for such tasks inside OnTimer();
Anyway, your work is valuable.
You could use OrderSendAsync to cut down the execution time of your OnTimer() function. Stil lyou would need to deal with varying execution times. - Why would you have code for placing orders in OnTimer? This seems out of concept.
Whats the reasinging behind such an approach?
OrderSendAsync
OrderSendAsync is a function in MT5. My EA has two versions for MT4 and MT5. I keep the same code as possible.
Actually the main trading work was done not in the timer thread but in the ChartEvent().
Timer thread in the receiving side checkes the connection with the sender periodically. If there is no keep-alive message between two sides, the sender will time-out the receiver and send no message to the receiver, which causes a big problem.
OrderSendAsync is a function in MT5. My EA has two versions for MT4 and MT5. I keep the same code as possible.
Actually the main trading work was done not in the timer thread but in the ChartEvent().
Timer thread in the receiving side checkes the connection with the sender periodically. If there is no keep-alive message between two sides, the sender will time-out the receiver and send no message to the receiver, which causes a big problem.
I need to test for 24 hours. it will print 24*3600 logs. It's very hard to find out if some seconds are missed.
Not 24 hours yet but...
The issue relies on your side, either something on the computer/OS, on the platform (MT4 is obsolete), on the workload or possibly in your code. You need to investigate if you want a solution, complaining is useless.
The sender is to notify the receiver to open a trade. At the moment the receiver is timed out. Several minutes passed, the receiver is re-connected but the order is missed. That's the consequence.
My underlying design is made with the assumption that timer is reliable.
Not 24 hours yet but...
The issue relies on your side, either something on the computer/OS, on the platform (MT4 is obsolete), on the workload or possibly in your code. You need to investigate if you want a solution, complaining is useless.
Thank you for your advice. MT4 is obsolete, but some brokers only support MT4, or charge less commision for MT4 account than MT5 account. I don't know why.
The sender is to notify the receiver to open a trade. At the moment the receiver is timed out. Several minutes passed, the receiver is re-connected but the order is missed. That's the consequence.
My underlying design is made with the assumption that timer is reliable.
I'm going to measure the execution time of each event handler to find out which part using CPU time.
Each MT4 starts two charts with two EAs. I guess MT4 gives the timer event to two EAs at the same time. One EA takes long execution time in some event handler may delay timer event. They are not fully independent.
I made a clean environment. I started only one EA(Timer.EX4) in MT4, which is compiled from the codes as attached.
But I had a log shows 6 seconds delay. This really puzzled me.
I had a log shows 6 seconds delay. This really puzzled me.
Try this.