From this Jared's suggestion in this post:

https://www.quantconnect.com/forum/discussion/1037/day-trading-close-all-positions-at-close-of-day/p1

Schedule.On(DateRules.EveryDay("SPY"), TimeRules.BeforeMarketClose("SPY", 10), () =>

{

Liquidate();

});

I'm a total newb but using the basic template, I'm trying to place orders and close them out. I was testing using 1 symbol but the algorithm buys and then immediately sells the security. How do I fix this so that I can control when the initial order is placed?