Can EA detect if other EAs are running? What about Uptime of terminal?

 

Can EA detect if other EAs are running in other charts of the same terminal? And can there be a list provided of the name of the EA?

Is there a method to detect the uptime of the terminal (amount of days:hours:min:sec the terminal has run since the process is running)?

 
4evermaat:

Can EA detect if other EAs are running in other charts of the same terminal? And can there be a list provided of the name of the EA?

Is there a method to detect the uptime of the terminal (amount of days:hours:min:sec the terminal has run since the process is running)?


if there is a open trade with magicnumber > 0 and it is not a magicnumber of the EA attached to the chart then the EA can detect the other EA trading

If you wanna have a list then you have to do something like I did in the indicators I made and published see https://www.mql5.com/en/code/10387

The last question yours I don't know what you exactly mean.....

but there is always a method to calculate a time but what is the time you wanna know ???

 
deVries:


if there is a open trade with magicnumber > 0 and it is not a magicnumber of the EA attached to the chart then the EA can detect the other EA trading

If you wanna have a list then you have to do something like I did in the indicators I made and published see https://www.mql5.com/en/code/10387

The last question yours I don't know what you exactly mean.....

but there is always a method to calculate a time but what is the time you wanna know ???


- uptime of the terminal (start time and/or total time that the terminal process has been running)

- uptime of EA (total time EA has been running since applied to chart; would reset if EA settings are changed or terminal is restarted)

 
4evermaat:

- uptime of the terminal (start time and/or total time that the terminal process has been running)

- uptime of EA (total time EA has been running since applied to chart; would reset if EA settings are changed or terminal is restarted)

  1. Nothing happens until a EA is placed on a chart, so I don't think so.
  2. datetime time.on.load=0;
    int init(){
       // if (time.on.load == 0) // Don't reset on chart changes etc.
          time.on.load = TimeCurrent();  // Reset on chart changes, EA settings, etc.
       :
    }
    int start(){
       datetime now = TimeCurrent();
       int      duration = now - time.on.load,
                seconds  = duration          % 60,
                minutes  = duration /     60 % 60,
                hours    = duration /   3600 % 24,
                days     = duration / 86400;
       Comment(WindowExpertName()+" up ",days, "-", RJust(hours,2), ":", RJust(minutes,2), ":", RJust(seconds,2));
       :
    }
    string  RJust(string s, int size, string fill="0"){
        while( StringLen(s) < size )    s = fill + s;       return(s);             }

 
4evermaat:

- uptime of the terminal (start time and/or total time that the terminal process has been running)

You can get Process creation time by Windows Api, here is my test script about it:
Files:
Reason: