Trying to have algorithm adjust / rebalance holdings at close of each day. However, the code I am using to try to force this is not working as expected:

if (DateTime.Now.TimeOfDay <= System.TimeSpan.Parse("15:45:00")) return;

Is there a better way to do this? Perhaps I could use MarketOnClose orders, however, because of the daily rebalancing, using SetHoldings is a very convenient way to define what I am trying to do.

Author