Back

Composite of ADX and ATR

Hello eyeryone I am new to Quantconnect and I am trying to build a composite indicator by dividing the ADX by the ATR. To accomplish this I am trying to use the IndicatorExtension.Over() method. However I always get a TypeError telling me I am trying to acces a method that doesn't exist. Replacing the ADX and ATR indicators with an EMA indicator fixes the problem. Does anyone know why this happens and how to build the ADX/ATR composite indicator. 

Thanks

Update Backtest







class BasicTemplateAlgorithm(QCAlgorithm):

def Initialize(self):

self.SetStartDate(2010, 1, 1) #Set Start Date
self.SetEndDate(2011, 1, 1) #Set End Date
self.SetCash(1000) #Set Strategy Cash

self.SetWarmUp(40)
self.warmingUp = True

self.symbols = ["SPY"]
self.symbolObjekts = []

for symbol in self.symbols:

self.AddEquity(symbol, Resolution.Daily)

indicators = {}

indicators["MA1"] = self.ALMA(symbol, 10, 6, 0.8, Resolution.Daily)
indicators["MA2"] = self.ALMA(symbol, 40, 6, 0.8, Resolution.Daily)
indicators["ATR"] = self.ATR(symbol, 10, MovingAverageType.Exponential, Resolution.Daily)
indicators["ADX"] = self.ADX(symbol, 18, Resolution.Daily)
indicators["Ema"] = self.EMA("SPY",3, Resolution.Daily)


indicators["ADX/ATR"] = IndicatorExtensions.Over(indicators["ADX"],indicators["ATR"])
indicators["EMA"] = ExponentialMovingAverage(3).of(indicators["ADX/ATR"])



SymbolObjekt = symbolObjekt(symbol, indicators)
self.symbolObjekts.append(SymbolObjekt)

def OnData(self, data):
if self. Time == self.StartDate:
self.warmingUp = False
Console.WriteLine("Finished WarmUp")

self.update_plots(data)

def update_plots(self, data):

if not self.warmingUp:
for symbolObjekt in self.symbolObjekts:
if(symbolObjekt.symbol == "SPY"):
SPYObjekt = symbolObjekt


#self.Plot('MA', 'Price', data["SPY"].Close)
#self.Plot('MA', 'MA1', SPYObjekt.indicators["MA1"].Current.Value)
#self.Plot('MA', 'MA2', SPYObjekt.indicators["MA2"].Current.Value)
#self.Plot('ATR', 'ATR', SPYObjekt.indicators["ATR"].Current.Value)
#self.Plot('ADX', 'ADX', SPYObjekt.indicators["ADX"].Current.Value)
#self.Plot('ADX/ATR', 'ADX/ATR', (SPYObjekt.indicators["ADX"].Current.Value/SPYObjekt.indicators["ATR"].Current.Value))

class symbolObjekt(object):
def __init__(self, symbol, indicators):
self.symbol = symbol
self.indicators = indicators
0

Thanks for bringing this to our attention. After looking into this issue the IndicatorExtensions.Over() method currently only supports parameters of the IndicatorBase<IndicatorDataPoint> type and the indicator ADX is not of that type. We have identified the issue and it is on our TODO list have .Over() support all indicator types.

0

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...

This discussion is closed