I'm trying to get a custom optimizer running, and have run into an issue whereby it seems that NinaTrader won't allow an optimizer to set values for enum or bool strategy parameters (perhaps other types too; so far only double and int have worked).
For such parameters, Parameter.ParameterType returns the correct .NET type, but trying to set Parameter.Value to an instance of that type causes an exception for Enum parameters while having no effect for bool parameters.
I tried setting bool parameters to 0/1 and enum parameters to (int)enumValue to see if NT would internally convert them, but that didn't help either - the values were just ignored.
How can the optimizer set strategy parameters of these types?
Also, what is the recommended way to pass the output of a fitness function back to the optimizer? A static member variable is a hack at best.
Thanks,
Swig.
Comment