I am trying to create a vortex indicator class however I'm struggling when trying to output multiple values from the indicator. As I am not outputing one Value I don't set the self.Value but rather self.Uptrend and self.Downtrend  corresponding to the respective lines for the Vortex Indicator:

from collections import deque import numpy as np from datetime import datetime class VI: def __init__(self, period): self.Name = "Vortex" self.Time = datetime.min self.IsReady = False self.Uptrend = 0 self.Downtrend = 0 self.queue = deque(maxlen=period+1) self.Period = period def __repr__(self): return f"{self.Name} -> IsReady: {self.IsReady}, Time: {self.Time}, Value: {self.Value}" def Update(self, input): self.queue.append(input) self.Time = input.EndTime sum_trn = 0 sum_vm_uptrend = 0 sum_vm_downtrend = 0 lows = np.array([x.Low for x in self.deque]) highs = np.array([x.High for x in self.deque]) closes = np.array([x.Close for x in self.deque]) for i in range(0, self.queue.maxlen - 1): sum_trn += np.nanmax( np.array([ highs[i] - lows[i], highs[i] - closes[i+1], lows[i] - closes[i+1] ])) sum_vm_uptrend += abs(highs[i] - lows[i+1]) sum_vm_downtrend += abs(lows[i] - highs[i+1]) self.Downtrend = sum_vm_uptrend / sum_trn self.Uptrend = sum_vm_downtrend / sum_trn self.IsReady = len(self.queue) == self.queue.maxlen return self.IsReady

This however throws an error as I have not used self.Value:

During the algorithm initialization, the following exception has occurred: NotImplementedException : Indicator.Value must be implemented. Please implement this missing method in VI at QuantConnect.Indicators.PythonIndicator.SetIndicator (Python.Runtime.PyObject indicator) [0x00097] in :0 at QuantConnect.Indicators.PythonIndicator..ctor (Python.Runtime.PyObject indicator) [0x0000c] in :0 at QuantConnect.Algorithm.QCAlgorithm.WrapPythonIndicator (Python.Runtime.PyObject pyObject) [0x0003c] in :0 at QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (QuantConnect.Symbol symbol, Python.Runtime.PyObject indicator, QuantConnect.Data.Consolidators.IDataConsolidator consolidator, Python.Runtime.PyObject selector) [0x0007d] in :0 at QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (QuantConnect.Symbol symbol, Python.Runtime.PyObject indicator, System.Nullable`1[T] resolution, Python.Runtime.PyObject selector) [0x0000d] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0 at Initialize in main.py:line 101 NotImplementedException : Indicator.Value must be implemented. Please implement this missing method in VI at QuantConnect.Indicators.PythonIndicator.SetIndicator (Python.Runtime.PyObject indicator) [0x00097] in :0 at QuantConnect.Indicators.PythonIndicator..ctor (Python.Runtime.PyObject indicator) [0x0000c] in :0 at QuantConnect.Algorithm.QCAlgorithm.WrapPythonIndicator (Python.Runtime.PyObject pyObject) [0x0003c] in :0 at QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (QuantConnect.Symbol symbol, Python.Runtime.PyObject indicator, QuantConnect.Data.Consolidators.IDataConsolidator consolidator, Python.Runtime.PyObject selector) [0x0007d] in :0 at QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (QuantConnect.Symbol symbol, Python.Runtime.PyObject indicator, System.Nullable`1[T] resolution, Python.Runtime.PyObject selector) [0x0000d] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0

Is there any way to output two values from a custom indicator, and then be able to plot that indicator using self.PlotIndicator()?

Author