stfl / backtestd-expert

8 stars 4 forks source link

Indicators can only have int or double inputs #2

Open stfl opened 3 years ago

stfl commented 3 years ago

Problem

The EA input fields are of type double. Transparently using them for int is no problem. string or bool does not work

If an Indicator has string or bool values mixed in with other inputs the iCustom initialization method fails and the Indicator cannot be instantiated.

inputs[] is simply copied to m_params https://github.com/stfl/backtestd-expert/blob/3860f55538c9f5feb23a5a63e1558e2a8e75490b/Include/backtestd/SignalClass/CustomSignal.mqh#L174-L186

and m_params is then used for ~m_indicator.Create()~ https://github.com/stfl/backtestd-expert/blob/3860f55538c9f5feb23a5a63e1558e2a8e75490b/Include/backtestd/SignalClass/CustomSignal.mqh#L235-L253

Workaround

Simply comment out string and bool inputs in the Indicator source and compile again ;) string or bool inputs have no meaning for backtesting anyway.. bool can also be converted to float and typecasted to bool ;)