| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -2.402 Tracking Error 0.123 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# Comparison of the QuantConnect built-in "Awesome Oscillator" with Vladimir's custom indicator
class CustomIndicatorAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 1, 1)
self.SetEndDate(2021, 7, 2)
self.stock = self.AddEquity('SPY', Resolution.Daily).Symbol
self.SetWarmUp(50, Resolution.Daily)
self.awesome_osc_qc = self.AO(self.stock, 5, 34, MovingAverageType.Simple, Resolution.Daily)
self.AwesomeOsc = CustomIndicator('Awesome Osc', 5, 34)
self.RegisterIndicator(self.stock, self.AwesomeOsc, Resolution.Daily)
def OnData(self, data):
if self.IsWarmingUp or not (self.awesome_osc_qc.IsReady or self.AwesomeOsc.IsReady): return
self.Plot("Awesome Osc", "AwesomeOsc_QC", -self.awesome_osc_qc.Current.Value)
self.Plot("Awesome Osc", "AwesomeOsc_Custom", self.AwesomeOsc.Value)
self.Plot("Awesome Osc", "Zero", 0)
class CustomIndicator(PythonIndicator):
def __init__(self, name, fast, slow):
self.Name = name
self.Time = datetime.min
self.Value = 0
self.fast = SimpleMovingAverage(fast)
self.slow = SimpleMovingAverage(slow)
self.Period = slow
def Update(self, input):
self.Time = input.EndTime
self.Value = 0
mp = (input.High + input.Low ) / 2
if not self.fast.Update(input.Time, mp):
return False
if not self.slow.Update(input.Time, mp):
return False
self.diff = (self.fast.Current.Value - self.slow.Current.Value)
self.Value = self.diff
return True