When exactly does Init() run for an EA? (apart from at program initialization)

 

I'm creating an EA which defines certain parameters / variables at Init().

When I started creating it, I was under the impression that Init() would only run when I first drag / enable the EA on a chart.

Of course, I've read the manual which says:

"In Expert Advisors the special function init() is called (and executed) after the client terminal start and uploading of historic data, after changing security and/or chart period, after program recompilation in MetaEditor, after changing input parameters from EA setup window and after account changing."

My question is: Does Init() also run when the connection is dropped or restored? Are there any other situations which cause Init() to run?

Based on my testing so far (leaving my EA on and unattended for several days), it seems I can't trust Init() to only run once, and to be sure I should keep on defining the key parameters at Start().

Has anyone else had a similar experience?

 
it seems I can't trust Init() to only run once, and to be sure I should keep on defining the key parameters at Start().

Not sure I follow the logic, if you put it into start(), it's going to run at every tick.


So you prefer it to run either once in init() or every time in start(), but not the 10 times or whatever number that init() is actually doing?

 

init() is not executed automatically upon dropping the connection and reconnecting.

Many of us run EAs in live environments for months without reinitialization.


CB

Reason: