Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
0.052%
Drawdown
0.100%
Expectancy
0
Net Profit
0.110%
Sharpe Ratio
0.689
Probabilistic Sharpe Ratio
31.364%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
-0.001
Annual Standard Deviation
0.001
Annual Variance
0
Information Ratio
-0.518
Tracking Error
0.233
Treynor Ratio
-0.803
Total Fees
$1.00
class OptimizedDynamicCoil(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 9, 30)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("SPY", Resolution.Daily)
        
        self.lm = None
        
    def OnData(self, data):
        if self.lm is None:
            self.LimitOrder('SPY', 1, 239)
            self.lm = self.LimitOrder('SPY', 1, 235)
        if self.Portfolio.Invested:
            self.lm.Cancel()