[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 113

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
Sometimes there are complex calculations or loading of history in init(), or there are a lot of indicators and EAs hanging on the terminal or...
but if the terminal interrupts the code during its initialization, there will be an error in the log like this:" .... timeout in expert ...."
If the log shows no error in the terminal, it means that initialization was successful. The start() function itself is easy to check - write in the first line start(): Print("new tick");
I did so((.
Yes, I'm rocking a lot of information, calculations too, experimenting with ticks...
Calculation takes 2 - 3 minutes, MT "doesn't hang", everything works typically, messages from Print() and Alert are displayed and then everything))
Looked at all the messages from MT, I could not find any errors...
Please assist.
Calculation takes 2 - 3 minutes, MT does not "hang", everything works typically, Print() and Alert messages are displayed and then everything))
if Print() is printed, start() definitely works, but I'm confused by your statement that the calculation takes 2-3 minutes - with such a load on the terminal you need to interrupt the calculations using the function sleep() otherwise the terminal will definitely hang.
Since MT4 has no debugger, insert Print() into questionable code sections and catch the code sections and conditions that failed or did not fail.
How do I check if an order is triggered by TakeProfit or StopLoss? Thank you for your reply!
Sayod ,what timeframe have you traded on and with what parameters?
What's the difference or you have it reversed and want to test it?
Traded on h1 by default,
Pip step - 30
LotExpo - 1.59
I think the parameters don't matter too much if the idea has been implemented, I think the Expert Advisor will be good with any parameters, IMHO.
I need to commit the fact of the open orders triggering by TakeProfit or StopLoss. I am not interested in the actual values of TakeProfit and StopLoss.
If you just want to register the fact of the order being triggered, then you can memorize the number of orders on the previous tick and compare it with the number of orders on the next tick - if the number of orders has changed, it means ....
The terminal closed the losing order with the comment "so:19.5%/28.4/145.8". What does this mean?
if Print() prints out, then surely you have start() working, but I am confused by your statement that the calculation takes 2-3 minutes - at such a load of the terminal you need to interrupt the calculations using the function sleep(), otherwise the terminal will definitely hang
Since MT4 has no debugger, insert Print() into doubtful code sections and catch the code sections and conditions that failed or did not fail.
Sorry, I've got it wrong, Print only works in init. I cannot get into start))
Yes, at the end of each function, I put print with a message about it, to check if everything is ok. And all messages (all functions) worked 100% until the end of the init, I can't go to start!
Thanks in advance for the answer!
Familiarise yourself with the code of both functions and merge them into one to optimise for speed of execution and for your specific tasks...
Sorry, I misspoke, Print only works in inite. I can't get into start))
Yes, at the end of each function, I insert a print with a message about it to check if everything is ok. And all messages (all functions) have worked 100% until the end of the init, I can't go to start!
Thanks in advance for the answer!
So you frankly don't have a tick in the terminal. I.e. either it's not connected, or you're working on an offline chart, or check IsExpertEnabled() in the init and if it's not allowed, then enable EAs.