Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
0.630%
Drawdown
0.700%
Expectancy
0
Net Profit
0.945%
Sharpe Ratio
0.785
Probabilistic Sharpe Ratio
37.644%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.001
Beta
0.042
Annual Standard Deviation
0.005
Annual Variance
0
Information Ratio
-0.994
Tracking Error
0.125
Treynor Ratio
0.102
Total Fees
$1.00
Estimated Strategy Capacity
$2100000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# region imports
from AlgorithmImports import *
# endregion

class SmoothYellowGreenScorpion(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 11, 4)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("SPY", Resolution.Minute)
        self.entryTicket = None

    def OnOrderEvent(self, orderEvent):
        if orderEvent.Status != OrderStatus.Filled:
            return

        if self.entryTicket is not None and self.entryTicket.OrderId == orderEvent.OrderId:
            self.Debug('stop loss placed')
            self.MarketOrder("SPY", -10)
        else:
            self.Debug(f'onOrderEvent: else @{self.Time}')

    def OnData(self, data: Slice):
        if not self.Portfolio.Invested:
            self.entryTicket = self.MarketOrder("SPY", 10)