| Overall Statistics |
|
Total Trades 930 Average Win 0.78% Average Loss -0.56% Compounding Annual Return 11.620% Drawdown 21.600% Expectancy 0.134 Net Profit 36.522% Sharpe Ratio 0.889 Probabilistic Sharpe Ratio 39.415% Loss Rate 53% Win Rate 47% Profit-Loss Ratio 1.41 Alpha 0.044 Beta 0.486 Annual Standard Deviation 0.157 Annual Variance 0.025 Information Ratio -0.35 Tracking Error 0.162 Treynor Ratio 0.288 Total Fees $1746.77 |
class TransdimensionalVerticalAntennaArray(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 3, 23) # Set Start Date
self.SetEndDate(2021, 1, 19)
self.SetCash(100000) # Set Strategy Cash
self.AddEquity("SPY", Resolution.Hour).Symbol
self.rvi = self.RVI('SPY', 14, Resolution.Hour)
self.tolerance = 0.001
self.AutomaticIndicatorWarmUp = True
def OnData(self, data):
if self.rvi.Current.Value >= self.rvi.Signal.Current.Value * (1 + self.tolerance):
self.SetHoldings("SPY", 1)
self.Plot('RVI', 'Value', self.rvi.Current.Value)
self.Plot('RVISignal', 'Value', self.rvi.Signal.Current.Value)
elif self.rvi.Current.Value < self.rvi.Signal.Current.Value:
self.Liquidate("SPY")
self.Plot('RVI', 'Value', self.rvi.Current.Value)
self.Plot('RVISignal', 'Value', self.rvi.Signal.Current.Value)
else:
self.Plot('RVI', 'Value', self.rvi.Current.Value)
self.Plot('RVISignal', 'Value', self.rvi.Signal.Current.Value)
return
# if self.rvi.Current.Value <= 0 and self.rvi.Current.Value >= self.rvi.Signal.Current.Value:
# self.SetHoldings("SPY", 1)
#
# elif self.rvi.Current.Value < self.rvi.Signal.Current.Value:
# self.Liquidate("SPY")
# else:
# return