Operation Timed Out - Run Time Error


Preface: New to QC and to C# - just moved over from Quantopian/Python. 

To get familiar with the website, I created a relatively "simple" program: check if there is a potential price arbitrage above 2 pips, and if so, print out "Now" to the console. I am simply trying to figure out how this software works.

As you can see from the backtest, I am getting this error: 


Runtime Error: Execution Security Error: Operation timed out - 1.33333333333333 minutes max. Check for recursive loops. (Open Stacktrace)

412 | 14:45:05:

Algorithm Id:(964546efb74bc28982cbb06b76fc57cf) completed in 80.61 seconds at 13k data points per second. Processing total of 1,041,707 data points."


What am I missing? Is there a context/rule/etc that I am missing? Why is it a runtime error?



Update Backtest

Hi Eric,

Welcome to QC :-)

I attached a modified backtest to illustrate a couple of things:

1.) Most importantly, I switched the resolution of the data to "minute" to be able to see anything printed at all.  You had a Console.WriteLine command in there, and I suspect that it was attempting to write all 86,000 lines that would each constitute a second across the length of 24 hours.  It's important to note that "tick" level resolution won't produce any text output, to keep the cpu from being bogged down.

2.) I provided you with some alternative options to Console.WriteLine at the bottom of the algorithm.  Use Log or Debug to print data, rather than Console.  Log is useful for printing to an output file (generally a little more forgiving on number of lines printed than Debug).  The output file is accessible after you complete a backtest; check the console for a link to it.  The Debug command is useful for printing out occasional blips of data to the console directly while the backtest is running.  Debug is tighter on number of lines you can print; it may suppress messaging entirely after it hits a certain limit.

3.) I explicitly declared your "var" variables as decimals.  No real reason other than cleanliness :-P

4.) I added a couple of "m" characters to the numbers that are supposed to be decimals.  In C#, if you multiply a decimal by a decimal, and you're expecting a decimal out of it, you'll need to make sure there is an "m" attached to each hardcoded number"

Let me know if there's anything else you need help with :-)


@Stephen Oehler - Thank you very much for the response! As you can tell, I am a little rusty with C#. I will let you know if I run into any other issues.

Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed