Hi,

TLDR: how do i generate a signal on close based on daily data and have the algorithm execute immediately on the same day?

I'm building a strategy that calculates a signal on all equities in my universe and then executes a single trade. My idea was to have that signal be calculated on close and then immediately buy or sell based on the signal given.

My problem is that the order execution is completely delayed. the order signal is generated at close (as i am using close prices) but the execution only happens 2 days later on market open when i'm using self.SetHoldings. This completely skews the performance.

I understand that on a daily timeframe the close prices are only available at close and orders have to be placed after that. I'd be happy if execution happens the next day on open, but it would be even better if it would be possible to get a price only once a day at 10 minutes before markets close and use that price as my closing price to execute the same day. 

I haven't found a solution that isn't based on consolidating hour or minute data. The problem is that the strategy calculates a value for over 3000 assets and i am already running low on RAM on my backtesting machine so switching to lower timeframes and consolidating is not really an option.

Any help is appreciated.