Indicator Extensions

Back

Hi All, 

Just moved from quantopian, and liking the look of the platform.

Attempting to replicate a strategy which normalises a smoothed ATR signal using the price 

 closes = data.history(symbol(sym), 'close', 200, '1d')
 highs = data.history(symbol(sym), 'high', 200, '1d')
 lows = data.history(symbol(sym), 'low', 200, '1d')

 fast_atr = talib.EMA(talib.ATR(highs,lows,closes,timeperiod=context.natr_fast)/
                         closes*100,timeperiod=5) 

The algo then trades on the signal

not sure how to do this within quantconnect.

Tried below which is pretty clumsy         

        self.fast_atr = self.ATR("SPXY", self.fast_atr_period, Resolution.Daily)
        self.n_fast_atr = IndicatorExtensions.Over(self.fast_atr,"SPXY")*100
        self.n_fast_atr_ema = IndicatorExtensions.EMA(self.n_fast_atr,5)

But it throughts up the following errorDuring the algorithm initialization, the following exception has occurred: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the Over method. Please checkout the API documentation.
at Initialize in main.py:line 37

TypeError : No method matches given arguments for Over

Any suggestions?
 

Update Backtest







 
0

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.


Hi Paul,
The best way to do this would be to register function a function to compute a value to update our EMA inside the ATR's update. I've shown this in the attached backtest. It doesn't seem that SPXY is an active ticker, so I've changed it to SPXU.

 

 

Best,
Shile Wen

0

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.


Update Backtest





0

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.


Loading...

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!