Let's calculate the backtest of our double-SMA strategy:
When we click on "Calculate backtest", we get the following error in the console, below the editor:
Average bar execution time is higher than 0.1ms
Why is this happening?
Firstly, ProQuant and, as an extension, QuantScript, is a free service. Your QuantScript strategies run in our cloud, for free, alongside the strategies of many other users. Therefore, we must enforce some performance limits to make sure one strategy does not hog resources from every other strategy in our cloud.
We want to ensure fast execution for everyone - that's why we've limited strategies to 0.1 milliseconds of execution time per bar.
If you manage to squeeze under that time restriction during backtesting, we'll allow you to run your strategy. If, while running, execution does happen to take longer than 0.1ms, we won't stop your strategy or throw an error - this probably happened due to a server hiccup on our side.
We also enforce limits on memory usage but more on that later.
Secondly, our current SMA implementation is just slow. Let's look at why that is and how we could speed it up.