I want to keep a variable's value to next call of run(), if I ran the code below for 2 bars period
function run(){
//1. if(is(INITRUN)) int x=0;
//2. if(is(FIRSTRUN)) int x=0;
//3. int x=0;
//4. static int x=0;
printf("%i",x);
x = 1;
printf("%i",x);
}
#1, 2 and 3 got me 0101, implying x was set again at each bar run.
#4 got me 0111, which is what I want.
I thought
if(is(INITRUN)) and
if(is(FITSTRUN)) would only set variable x once.