I would like to pick stock based on the simple moving average. In CoarseSelect, I cache the stock data by using History for initialization. There are around 45xx stocks are included in my selection. During the backtest, the time limit error may be triggered. I would like to ask if there is a way to speed up.

Attached a backtest is an example, I just init and update the SimpleMovingAverage. Sometime this test case will hit time limit, somethime this test case has no problem. I hope this is enough to show what is my question.

Thank you very much.