Overall Statistics
Total Trades
70
Average Win
0.17%
Average Loss
-0.10%
Compounding Annual Return
-39.545%
Drawdown
3.100%
Expectancy
-0.921
Net Profit
-3.077%
Sharpe Ratio
-3.139
Probabilistic Sharpe Ratio
0.479%
Loss Rate
97%
Win Rate
3%
Profit-Loss Ratio
1.76
Alpha
-0.14
Beta
0.049
Annual Standard Deviation
0.045
Annual Variance
0.002
Information Ratio
-0.53
Tracking Error
0.185
Treynor Ratio
-2.903
Total Fees
$70.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
QQQ XVD806ISXMJQ|QQQ RIWIV7K5Z9LX
# region imports
from AlgorithmImports import *
# endregion

class CreativeFluorescentYellowCamel(QCAlgorithm):

    def Initialize(self):

        # Dates
        self.SetStartDate(2022, 1, 19)
        self.SetEndDate(2022, 2, 10)

        # Set Strategy Cash
        self.SetCash(100000)

        # Add ETF
        QQQ = self.AddEquity("QQQ").Symbol
        self.QQQ_MACD = MovingAverageConvergenceDivergence(12, 26, 9)
        self.RegisterIndicator(QQQ, self.QQQ_MACD, Resolution.Minute)
        
        # Add option
        option = self.AddOption("QQQ")
        option.SetFilter(minExpiry = timedelta(days = 1), maxExpiry = timedelta(days = 4))
        self.QQQ_option_symbol = option.Symbol
            
        # Warmup
        self.SetWarmUp(timedelta(days = 5))

    def OnData(self, data: Slice):

        # If not warming up
        if not self.IsWarmingUp:

            # Entry
            if not self.Portfolio.Invested:
                if self.QQQ_MACD.Current.Value > self.QQQ_MACD.Signal.Current.Value:
                    chain = data.OptionChains.get(self.QQQ_option_symbol)
                    if chain:
                        for contract in chain:
                            self.MarketOrder(contract.Symbol, 1)
                            break

            # Exit
            else:
                if self.QQQ_MACD.Current.Value < self.QQQ_MACD.Signal.Current.Value:
                    self.Liquidate()