HowTo change Server (rescan and new connect/login) by an EA?

 

Hi,

is that possible and how can it be done, that an EA checks 1) the latency to an server

  1. check the latency of its actual server mybe just by

    beg = GetTickCount();
    ord = OrdersTotal();
    latency = GetTickCount() - beg;
  2. decides: this os ok - do nothing
  3. decides: too big check for a better one
    // disconnect the actual server
    void disconn() { ?? }
    // scan for the other maybe from a list?
    string scanForBetterServer() { ?? }
    // re-connect
    void reconn (string betterServer) { .. }

Does anbody has an idea how this can be programmed within an EA?

Thanks in advance,

Gooly

 
No one was able to figure this out?
 
  1. beg = GetTickCount();
    ord = OrdersTotal();
    latency = GetTickCount() - beg;
    OrdersTotal is not a server call. All it does is read a variable out of the terminal. Won't work.
  2. EA periodically restart the terminal Terminal auto restart. - MQL4 forum replace the call to CloseTerminal with new terminalclose
  3. You're not co-located with the broker's server so latency is unavoidable so why do you care?
Reason: