I stuck with this problem: I cannot make to work OnBarClose indicators correctly with per tick strategy.
I have real time strategy with CalculateOnBarClose set to false. However I use indicators that produce safe values only at the end of the bar. So I have FirstTick condition and feed these aquired values to Indicators via DataSeries array like shown below:
protected override void OnBarUpdate()
{
if (FirstTickOfBar) {
indicatorData.Set(Input[1]);
getValue = MyIndicator( indicatorData, someMax, someMin );
}
// etc.
}
Also I have added these indicators to Initialize() constructor of my strategy like this:
indicatorData = new DataSeries(this);
if (drawValues) {
Add(MyIndicator( indicatorData, someMax, someMin ));
}
indicatorData is private DataSeries indicatorData;
To my amazement this plot is completely out of sync with data (zero values) for about 240 bars and there is no logic that controls when to start plot values or smth. If I remove indicatorData array from parameters to my Indicator - I get real time plot, that changes values on real time. And while it is fun to watch live plot, it triggers setups that are no longer valid after next bar. My solution to feed OnBarClose input values in array seemed like elegant solution but it doesn't seem to work. Am I missing something?
Thank you very much,
-A.

Comment