Now, I want to use a custom indicator that I created and use it as buy and sell signal in a strategy: Basically if CustomIndicator.BoolValue[0] == true, then buy and if CustomIndicator.BoolValue[0] == false then sell. Everything works perfect with optimization if IsInstantiatedOnEachOptimizationIteration is set to true. However, it doesn't work if I set it to false. I guess, the problem is that with the custom indicator the full logic is not in the strategy code but in the indicator code.
I tried to reset all variables within the indicator(!) code in State.DataLoaded. But it still doesn't work. I can't reset the variables in the strategy code as these variables only exist within the indicator code. The error is "accessing an index with a value out of range".
How can I use IsInstantiatedOnEachOptimizationIteration = false with a custom indicator that has variables? Is this even possible?
Thanks in advance!!
Comment