datetime OldBar; void OnTick() { if (OldBar != Time[0]) { CheckOpening(); OldBar = Time[0]; } CheckOrders(); }