Is there any difference if..

 
I put a variable right after extern variable comparing to in init() function?
Let say we have a bool variable "Trade"

Is there any difference if we put it here :
#property copyright "Metaquotes"
 
//---- input parameters
extern int   Lots   = 0.1;
 
bool trade=true; 
comparing to here :
#property copyright "Metaquotes"
 
//---- input parameters
extern int   Lots   = 0.1;
 
bool trade;
 
init()
{
  trade=true;
}
And about init(), this function only accessed once right? but if we have an internet disconnection and then connected again, is this function will be accessed again (without removing the EA from the chart) ?

Thank you
 

Yes.

For example You change chart's period. Init function called but EA is not reloaded

 
I see, that's explain my EA's behavior. I thought the init() function only called once until it's re-attach again.

And what about deinit() function, will it be called if when my connection is stopped or I change my chart's period?

Thank you.
 
https://docs.mql4.com/basis/functions/special

https://docs.mql4.com/check/UninitializeReason
 
phy:

https://docs.mql4.com/basis/functions/special

https://docs.mql4.com/check/UninitializeReason

I think I'm still don't understand. Is deinit() function will be called if my connection is stopped or my chart's period is changed?
 
It will be called on chart change, yes
 
Okay. Thank you Phy and Stringo.
Reason: