Overall Statistics
Total Trades
644
Average Win
1.01%
Average Loss
-1.11%
Compounding Annual Return
14.789%
Drawdown
16.300%
Expectancy
0.117
Net Profit
49.264%
Sharpe Ratio
0.901
Probabilistic Sharpe Ratio
38.404%
Loss Rate
42%
Win Rate
58%
Profit-Loss Ratio
0.91
Alpha
0.05
Beta
0.547
Annual Standard Deviation
0.12
Annual Variance
0.014
Information Ratio
0.026
Tracking Error
0.109
Treynor Ratio
0.197
Total Fees
$1138.10
Estimated Strategy Capacity
$1200000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
60.56%
#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.AddEquity("SPY", Resolution.Daily, dataNormalizationMode=DataNormalizationMode.SplitAdjusted)
        self.BuyIn = 0.0


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