[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 37

 
It could be simpler to restart the terminal every hour with a third-party program, these errors don't pop up very often, once or twice a day...
 
I think I've got it. I need to give the EA a command to restart Windows (without a login password) and put the terminal in the OS autostart. Thanks for the options.
 
DmitriyN:

Depends on the type of system. The bigger the leverage, the smaller the deposit, the better. However, you should take into account that the brokerage company may change the leverage: some do it periodically, some - change it when the deposit grows over a certain amount. Reducing leverage is an effective tool for brokerage companies. When using a martingale-like system, it is better to work with 1:200 and higher leverage, better 1:500...1:1000.

Thanks for the clarification.
 
-Aleksey-:
I think I've got it. I need to give the EA a command to restart Windows (without a login password), and put the terminal in the OS autostart. Thanks for the options.
Too global and rather slow. It would be sufficient to monitor the terminal activity with RestartOnCrash, and in case of connection failure give Alt+F4 command to the terminal (in the script via VinApi), the program will instantly launch it again.
 
evillive:
Too global and quite slow. It would be enough to monitor the terminal activity with RestartOnCrash, and in case of connection failure give Alt+F4 command to the terminal (in the script via VinApi), that program will quickly launch it again.
Broken connection: error 6 is handled by my Expert Advisor through server rescan. I've found an example on the forum. Or maybe you mean another error? I will look through the program, thanks.
 
General Error also leads to a connection failure. Above I wrote that I put myself in the terminal script s-Reconnect, it handles such errors as No connection and General Error, when they occur re-login and all. But it's easier to restart the terminal at any such error, it takes about the same amount of time.
 

This restart.vbs script restarts the terminal. How do I run it from the EA?

'+++++++++++++++++++++
'terminate application
'+++++++++++++++++++++
Const strComputer = "." 
Dim objWMIService, colProcessList
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'terminal.exe'")
For Each objProcess in colProcessList 
   objProcess.Terminate() 
Next
Set objWMIService = Nothing
Set colProcessList = Nothing
'+++++++++++++
'waiting pause
'+++++++++++++
WScript.Sleep 5000
'++++++++++++++++
'run appplication
'++++++++++++++++
Dim ProgramPath, objShell
ProgramPath = "D:\Program Files\Metatrader\terminal.exe"
Set objShell = createobject("Wscript.Shell")
objShell.Run Quote(ProgramPath), 1
Set objShell = Nothing
'+++++++++++++++++
'quotes processing
'+++++++++++++++++
Function Quote(sText)
    Quote = chr(34) & sText & chr(34)
End Function
 
-Aleksey-:

This restart.vbs script restarts the terminal. How do I run it from the EA?


You don't have to run it from the Expert Advisor. You can run this script every half an hour or an hour through the scheduler.
 
evillive:

You don't have to use the advisor. You can run this script every half hour or an hour through the scheduler.
Why not, if an error has been detected by the Expert Advisor? You can fail to set or modify an order within half an hour. What is a scheduler - I have never used one...?
 

Well then, here is https://www.mql5.com/ru/forum/106619

Windows Task Scheduler, allows you to do things like send mail, run apps/scripts/buttons, etc. on a schedule or by signal.

Reason: