| Overall Statistics |
|
Total Orders 1736 Average Win 1.30% Average Loss -0.71% Compounding Annual Return 25.304% Drawdown 49.100% Expectancy 0.105 Start Equity 10000 End Equity 16351.47 Net Profit 63.515% Sharpe Ratio 0.577 Sortino Ratio 0.825 Probabilistic Sharpe Ratio 23.754% Loss Rate 61% Win Rate 39% Profit-Loss Ratio 1.83 Alpha 0.207 Beta 0.391 Annual Standard Deviation 0.364 Annual Variance 0.133 Information Ratio 0.542 Tracking Error 0.372 Treynor Ratio 0.538 Total Fees $3188.65 Estimated Strategy Capacity $820000.00 Lowest Capacity Asset GME SC72NCBXXAHX Portfolio Turnover 75.50% |
# region imports
from AlgorithmImports import *
# endregion
class LogicalOrangeGorilla(QCAlgorithm):
def initialize(self):
self.set_start_date(2022, 1, 1)
self.set_end_date(2024, 5, 27)
self.set_cash(10000)
self.gme = self.add_equity("GME", Resolution.MINUTE)
self.amc = self.add_equity("AMC", Resolution.MINUTE)
self.averages = {}
self.previous_increase = False
def on_data(self, data: Slice):
for symbol in ['GME', 'AMC']:
if symbol not in self.averages:
self.averages[symbol] = SelectionData()
self.averages[symbol].update(self.time, self.securities[symbol].close)
if self.averages['GME'].is_ready:
if self.averages['GME'].fast.Current.Value < self.averages['GME'].slow.Current.Value and self.previous_increase == True:
self.set_holdings('GME', .475)
self.set_holdings('AMC', -.475)
self.previous_increase = False
elif self.averages['GME'].fast.Current.Value > self.averages['GME'].slow.Current.Value and self.previous_increase == False:
self.liquidate('AMC')
self.previous_increase = True
class SelectionData(object):
def __init__(self):
self.slow = ExponentialMovingAverage(200)
self.fast = ExponentialMovingAverage(50)
def is_ready(self):
return self.slow.is_ready and self.fast.is_ready
def update(self, time, price):
self.fast.update(time, price)
self.slow.update(time, price)