I don't quite understand when I should execute the cumulativeDelta.Update and with what parameters. I want to use the DeltaOpen[0] for current bar on different timefrime (volume or mins).
How to change this code to be able to read DeltaOpen[0] for particular BarsInProgress?
protected override void OnStateChange()
...
{
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Tick, 1);
AddDataSeries(Data.BarsPeriodType.Min 5);
}
else if (State == State.DataLoaded)
{
cumulativeDelta = OrderFlowCumulativeDelta(CumulativeDeltaType.BidAs k, CumulativeDeltaPeriod.Session, 0);
}
}
protected override void OnBarUpdate()
{
if (CurrentBars[0] < 1
|| CurrentBars[1] < 1
|| CurrentBars[2] < 1
)
return;
if (BarsInProgress == 0)
{
Print("Delta Open: " + cumulativeDelta.DeltaOpen[0]);
Print("Delta Close: " + cumulativeDelta.DeltaClose[0]);
Print("Time: " + Time[0] + "; " + CurrentBar);
}
if (BarsInProgress == 1)
{
cumulativeDelta.Update(cumulativeDelta.BarsArray[[B]1[/B]].Count - 1, 1);
Print("Delta Open: " + cumulativeDelta.DeltaOpen[0]);
Print("Delta Close: " + cumulativeDelta.DeltaClose[0]);
Print("Time: " + Time[0] + "; " + CurrentBar);
}
if (BarsInProgress == 2)
{
cumulativeDelta.Update(cumulativeDelta.BarsArray[[B]2[/B]].Count - 1, 1);
Print("Delta Open: " + cumulativeDelta.DeltaOpen[0]);
Print("Delta Close: " + cumulativeDelta.DeltaClose[0]);
Print("Time: " + Time[0] + "; " + CurrentBar);
}

Comment