Consider:
public override void Dispose()
{
// Clean up your resources here
Print ("In Dispose...");
base.Dispose();
}
protected override void Initialize()
{
Print ("In Initialize...");
}
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values.
Print ("Entering -- CurrentBar=1.");
}
When I add this indicator to a chart, the output window looks as follows:
In Dispose...
In Initialize... (I think these two occur when I select the indicator in the dialog window...)
In Initialize...
In Initialize...
In Initialize...
In Dispose...
Entering -- CurrentBar=1.
I immediately remove the indicator and the following gets added:
In Dispose...
In Initialize...
In Dispose...
In Initialize...
In Dispose...
In Dispose...
In Dispose...
The protected override void Initialize() is described as being "called once"...
Is this correct behavior?
Why do these routines get called so many times?
Why does Dispose get called when starting...... If I clean up my resources, I won't be able to start!
Can anyone explain?

Comment