protected override void OnData(DataObject obj)
{
bool barOpen = this.bar == null;
base.OnData(obj);
if (barOpen)
{
var success = AddReminder(GetBarCloseDateTime(obj), this.type);
if (!success)
{
if (obj is Tick)
Console.WriteLine($"TimeBarFactoryItem::OnData Can not add reminder. Clock = {this.type} local datetime = {this.factory.Framework.Clock.DateTime} exchange dateTime = {this.factory.Framework.ExchangeClock.DateTime} object = {obj} object exchange datetime = {(obj as Tick).ExchangeDateTime} reminder datetime = {GetBarCloseDateTime(obj)}");
else
Console.WriteLine($"TimeBarFactoryItem::OnData Can not add reminder. Object is not tick! Clock = {this.type} local datetime = {this.factory.Framework.Clock.DateTime} exchange datetime = {this.factory.Framework.ExchangeClock.DateTime} object = {obj} reminder datetime = {GetBarCloseDateTime(obj)}");
}
}
//bool flag = this.bar == null;
//base.OnData(obj);
//if (!flag || AddReminder(GetBarCloseDateTime(obj), this.type))
// return;
//if (obj is Tick)
// Console.WriteLine($"TimeBarFactoryItem::OnData Can not add reminder. Clock = {this.type} local datetime = {this.factory.Framework.Clock.DateTime} exchange dateTime = {this.factory.Framework.ExchangeClock.DateTime} object = {obj} object exchange datetime = {(obj as Tick).ExchangeDateTime} reminder datetime = {GetBarCloseDateTime(obj)}");
//else
// Console.WriteLine($"TimeBarFactoryItem::OnData Can not add reminder. Object is not tick! Clock = {this.type} local datetime = {this.factory.Framework.Clock.DateTime} exchange datetime = {this.factory.Framework.ExchangeClock.DateTime} object = {obj} reminder datetime = {GetBarCloseDateTime(obj)}");
}