Overall Statistics
Total Trades
1450
Average Win
0.20%
Average Loss
-0.06%
Compounding Annual Return
-3.104%
Drawdown
9.000%
Expectancy
-0.216
Net Profit
-8.763%
Sharpe Ratio
-1.025
Probabilistic Sharpe Ratio
0.001%
Loss Rate
82%
Win Rate
18%
Profit-Loss Ratio
3.44
Alpha
-0.023
Beta
0.013
Annual Standard Deviation
0.021
Annual Variance
0
Information Ratio
-0.799
Tracking Error
0.16
Treynor Ratio
-1.618
Total Fees
$1760.12
Estimated Strategy Capacity
$19000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
135.90%
#region imports
from AlgorithmImports import *
#endregion
class MultidimensionalDynamicComputer(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 4, 20)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.spy = self.AddEquity("SPY", Resolution.Minute, dataNormalizationMode=DataNormalizationMode.SplitAdjusted)
        self.BuyIn = 0.0
        DailyConsolidator = TradeBarConsolidator(timedelta(days=1))
        DailyConsolidator.DataConsolidated += self.DailyBarHandler
        self.SubscriptionManager.AddConsolidator(self.spy.Symbol, DailyConsolidator)

    def OnData(self, data):
        CurrentPrice = self.Securities["SPY"].Price
        if CurrentPrice > self.BuyIn+1 or CurrentPrice < self.BuyIn-1: 
            self.SetHoldings("SPY", 0) 
            return 

    def DailyBarHandler(self, sender, consolidated):
        CurrentPrice = consolidated.Price
        if not self.Portfolio.Invested:
            self.BuyIn = CurrentPrice
            self.SetHoldings("SPY", 1) # A market buy
            return