Reinitialize local STATIC variable upon ChartSetSymbolPeriod()

To add comments, please log in or register
timkrug
92
timkrug  

A static variable retains it's value even after Symbol or Period change of the chart. 

Is there a way to reinitialize local static variables upon Symbol or Period change?

Or is there only the possibility to declare the variable on the global scope and reinitialize it in OnInit()?


void TestStatic()
  {
  static int x=0; //Please reinitialize with 0 upon ChartChange

  Print(x);
  x++;
    
  return;
  }
Flavio Jarabeck
45147
Flavio Jarabeck  

I think you should go with GLOBAL and handle it on OnInit()...

STATIC variables in general have a ver very specific usage...

;)

To add comments, please log in or register