I'm trying to recreate indicators like in the tutorials, so that I don't have to make individual consolidators for a list of symbols, but I'm running into a recursion error.
…
# create a 15 day exponential moving average
self.fast = self.EMA(self.symbol, 15, Resolution.Daily);
# create a 30 day exponential moving average
self.slow = self.EMA(self.symbol, 30, Resolution.Daily);
…
if self.fast > self.slow: < ------- This is where error is hitting
Runtime Error: RecursionError : maximum recursion depth exceeded while calling a Python object
at OnData
if self.fast.Current.Value > self.slow.Current.Value * Decimal(1 + tolerance):
===
at Python.Runtime.PyObject.Invoke(PyTuple args in main.py:line 55
RecursionError : maximum recursion depth exceeded while calling a Python object (Open Stacktrace)
Is something like this format still possible to make work?
Zicai Feng
Hi Tomes,
please take out “Decimal”, it should work (as to why, I am not familiar enough with Decimal function to answer that)
also you might need to change self.Time.Date to self.Time.date()
Zicai Feng
oh, just noticed some of those logics are from the C# land, that explains…
yeah no need to use “Decimal” in python
Vladimir
Zicai Feng,
Try this "EMA Cross Algorithm"
Vladimir
The same rebalanced daily.
Def returns
Thanks y'all. Removing Decimal worked. I'll make sure I'm not taking any logic from C# anymore. I appreciate the EMA crossover algo to look at too.
Def returns
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!