Hi,

I have a Python custom indicator derived from a C# Indicator class but am unable to override one of the C# methods. The value returned by the Python indicator is the C# value, not the override value. 

Can a function in a derived Python class override a C# class method? 

I’ve checked out the QC discussion forum but couldn’t find an similar situation, my apologies if I missed one.

The Python custom indicator is derived from the C# QuantConnect.Indicators namespace class:

public class VolumeWeightedAveragePriceIndicator : TradeBarIndicator, IIndicatorWarmUpPeriodProvider

My indicator design needs to override the C# indicator method:

        protected virtual decimal GetTimeWeightedAveragePrice(TradeBar input)  {

            return (input.Open + input.High + input.Low + input.Value) / 4;        }

 My custom indicator file has the directive:

from QuantConnect.Indicators import VolumeWeightedAveragePriceIndicator as vwapOrig

But not the directive:

from clr import AddReference . . .

Which I assume the Quantconnect Backtest environment provides automatically, because everything runs with and without the clr import directive.

My custom indicator class __init__   function has:

vwapCloseInd = vwapOrig1( aSymbol, period)

Where the derived class is:

class vwapOrig1(vwapOrig):

    def __init__(self, name, period):

        super().__init__(name, period)

    def GetTimeWeightedAveragePrice(self, input):

        return input.Close

However the derived vwapOrig1 class function GetTimeWeightedAveragePrice, does not override the C# method, as expected. The custom indicator class, Update function receives the C# average price value and not the python override class  input.Close  price value.

Should the GetTimeWeightedAveragePrice function of the vwapOrig1 Python class derived from the C# VolumeWeightedAveragePriceIndicator class override the C# method GetTimeWeightedAveragePrice ?

Thanks for any insights.

Chris