Dynamic change of expert's indicator periods on the flow

 
Hello, I need to change period of some custom indicators on the flow. What can be the suitable code for this? I need to code like A. Is this a valid code after compilation the code? I mean, can iCustom and other built in indicators functions access custom period values on the flow? Or should I need to include all necessary (indicator X period) possibilities before compile time? And how can I force the terminal, all bars of possible periods to be updated while expert is active? (Code B is correct in any time, I know this.)

Thanks

//A*************************************
if (MarketisFast())
  PERIOD_HX = PERIOD_H1;
else
 PERIOD_HX = PERIOD_M15;
...
x = iCustom("EURUSD", PERIOD_HX, "HMA", 8, 0, 1);
//**************************************

//B*************************************
if (MarketisFast())
  x = iCustom("EURUSD", PERIOD_H1, "HMA", 8, 0, 1);
else
  x = iCustom("EURUSD", PERIOD_M15, "HMA", 8, 0, 1);
//***************************************