I want to initialize variables in a strategy in function of the instrument chosen, something like this:
switch (Instrument.MasterInstrument.Name) {
case "6E":
natr = 2.0;
break;
case "CL":
natr = 1.6;
break;
case "EMD":
natr = 2.0;
break;
case "ZB":
natr = 1.8;
break; }
I guessed that this code should go in the Initialize() method but, for any reason it doesn't work. It only works when I put it in the OnBarUpdate() method. But I do want to execute once, not in every bar.
I suppose there is a very simple solution, but I haven't find it yet so any ideas will be wellcome...
Un saludo,
Pablo
Comment