Globally declared and static variables keep their value between calls. If you don’t want that set the value at the top of OnTick.
There is only one OnTick (for EAs,) OnStart (for scripts,) or OnCalculate (for indicators.) Do not use more than one.
Of course you can give it a value in OnStart (if and only if it is a script.) Just do it:
int OnTick(){
X x=0.0;
:
If you want to reset variables on chart change (symbol/TF) remember the change and do it.
bool isFirstTick;
int OnInit(){ isFirstTick=true; ... }
int OnTick(){
static X x;
if(isFirstTick){ isFirstTick=false; x=0.0; ... }
:
x=30;
Your post is almost unintelligible. Show your code and state your problem.