Overall Statistics
Total Orders
9
Average Win
13.29%
Average Loss
0%
Compounding Annual Return
17.565%
Drawdown
26.000%
Expectancy
0
Start Equity
100000
End Equity
176611.84
Net Profit
76.612%
Sharpe Ratio
0.608
Sortino Ratio
0.609
Probabilistic Sharpe Ratio
25.375%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.044
Beta
0.851
Annual Standard Deviation
0.181
Annual Variance
0.033
Information Ratio
0.235
Tracking Error
0.138
Treynor Ratio
0.129
Total Fees
$39.86
Estimated Strategy Capacity
$330000000.00
Lowest Capacity Asset
AAPL R735QTJ8XC9X
Portfolio Turnover
0.68%
# region imports
from AlgorithmImports import *
# endregion

class Magnificent7(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2020, 11, 10)
        # self.set_end_date(2024, 4, 1) # Set End Date

        self.set_cash(100000)
        self._symbolAA = self.add_equity("AAPL", Resolution.DAILY)
        self._sma = SimpleMovingAverage(100)
        self.SetBenchmark("SPY")

    def on_data(self, slice: Slice):
        bar = slice.bars.get(self._symbolAA.symbol)
        if bar:
            self._sma.update(bar.EndTime, bar.Close)
        if self._sma.is_ready:
            self.plot("SimpleMovingAverage", "sma", self._sma.current.value)
            if bar:
                if not self.portfolio.invested and bar.Close < self._sma.current.value:
                    self.set_holdings("AAPL", 1)
                elif self.portfolio.invested and bar.Close > 1.1*self._sma.current.value:
                    self.set_holdings("AAPL", 0)