An indicator always starts at bar zero, but a strategy does not. I guess this is the problem you have with the NT code example.
To perform a proper runtime initialisation with a strategy I use the following approach:
privatebool runtimeInit;
...
protectedoverridevoid OnBarUpdate()
{
if (FirstTickOfBar)
{
if (!runtimeInit)
{
... your initial code ...
runtimeInit = true;
}
}
}
This is the only way to initialize your timer properly within a strategy I personally know of.
Regards
Ralph

Comment