Hey me,
i found the answer for my second question:
do { // sth Print("Hello World..."); } while ( IsStopped() == 0 );
but still need a solution for handling the debug stop handling.
Hey all,
my first question is about the debug mode. When i stop the debugging mode, the EA in the Terminal simply terminates and i am not able to handle some cleanup tasks like disconnecting from data base.
Capture a keystroke (e.g. CTRL-Q) in OnChartEvent() then run ExpertRemove(). This will fire off the OnDeinit(), which is where I do my cleanup.
Capture a keystroke (e.g. CTRL-Q) in OnChartEvent() then run ExpertRemove(). This will fire off the OnDeinit(), which is where I do my cleanup.
Yo, thank you very much for this idea :D i have implemented and it work perfectly. The only thing i could'nt manage is to combine both, like pressed STRG and Q.
I have this solved with a boolean serie...press first STRG and then Q
Yo, thank you very much for this idea :D i have implemented and it work perfectly. The only thing i could'nt manage is to combine both, like pressed STRG and Q.
I have this solved with a boolean serie...press first STRG and then Q
See TerminalInfoInteger.
Yes, as Alain points out, TerminalInfoInteger() will give you a useful keystate.
if(id==CHARTEVENT_KEYDOWN) { // q key if ( (int) (lparam) == KEY_Q ) { int keystate = TerminalInfoInteger(TERMINAL_KEYSTATE_CONTROL); if ( keystate == -127 || keystate == -128 ) { // This is quicker than right-clicking -> Remove Print("Removing Expert"); ExpertRemove(); } } . . . }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey all,
my first question is about the debug mode. When i stop the debugging mode, the EA in the Terminal simply terminates and i am not able to handle some cleanup tasks like disconnecting from data base.
My second question is similar to the first one. I wrote a daemon ea ( while loop ) which run in his own tick rhyhtmus, but the while loop runs for ever and i could not find any system variable or function to trigger a close request of the current process. My daemon runs so far and do good work, but he has no clean shutdown and leave open database connections which is not cool.
Is there any way to capture a stop request from the normal and debug mode ?
Thank you & Best regrads, Chris