init() function
Is init() function used only one time when the expert advisor is initalized or init() function is used more times by the expert ?
From https://docs.mql4.com/runtime/start:
I'm being pedantic and I suspect it won't matter for OP, but I'm not so sure that description is technically accurate. In my (limited) experience, init() is called at the first tick after attaching it to the chart rather than immediately. I have had trouble with my connection managment EA and if on a restart, there is no tick, it won't load the init() of the EA.
My 2 cents
V
[...] In my (limited) experience, init() is called at the first tick after attaching it to the chart rather than immediately. [...]
Is init() function used only one time when the expert advisor is initalized or init() function is used more times by the expert ?
I ask because I don't know where is better set default values for defined variables : on init() function or as an extern value.