Keep Indicator performing without vps/metatrader in focus

 
I wrote an indicator that calls scripts via keyboard shortcut (video attachment). When a metatrader window is not active or a VPS is not being accessed, apparently a thread is frozen, and when metatrader / vps is selected again the program resumes execution.

Note1: I'm using oncalculate to coordinate the flow. If i need to change the function let me know.

Note2: it must be an indicator and not an EA



Does anyone have a suggestion?
 

It is not “frozen”; you are sending keyboard events to the window with focus, and that is not MetaTrader.

Move the scripts into the EA and let the indicator indicate.

An alternative would be to buy a macro processor, to keep the terminal focused, but that will not work on the MetaQuotes VPS.