Overall Statistics
Total Orders
134
Average Win
0.04%
Average Loss
-0.04%
Compounding Annual Return
-3.794%
Drawdown
2.100%
Expectancy
-0.878
Start Equity
10000
End Equity
9785.51
Net Profit
-2.145%
Sharpe Ratio
-4.073
Sortino Ratio
-1.831
Probabilistic Sharpe Ratio
0.000%
Loss Rate
94%
Win Rate
6%
Profit-Loss Ratio
1.04
Alpha
-0.031
Beta
0.01
Annual Standard Deviation
0.007
Annual Variance
0
Information Ratio
-2.423
Tracking Error
0.11
Treynor Ratio
-2.982
Total Fees
$134.00
Estimated Strategy Capacity
$11000000.00
Lowest Capacity Asset
GME SC72NCBXXAHX
Portfolio Turnover
0.29%
# region imports
from AlgorithmImports import *
# endregion


#class MomentumAlgorithm(QCAlgorithm):
 ##   def initialize(self) -> None:
   #     self._symbol = self.add_equity("GME", Resolution.MINUTE).symbol



class JumpingBrownJellyfish(QCAlgorithm):

    def initialize(self):
        self._symbol = "GME"
        self.set_start_date(2020, 12, 31)
        self.set_end_date(2021,7,25)
        self.set_cash(10000)
        self._equity = self.add_equity(self._symbol, Resolution.MINUTE)

       # self._mom = Momentum(20)
        #self.register_indicator(self._stock, self._mom, Resolution.MINUTE)
        self._rocp = self.rocp(self._symbol, 10)
        

    def on_data(self, data: Slice):
      #  self.log("symbol close:  " + str(self.Securities[self._symbol].Close) + " ,     rocp indicator: " + str(self._rocp.current.value))
     #   self.log("rocp indicator: " + str(self._rocp.current.value))
        # if self._mom.is_ready:
        if self._rocp.is_ready:
            self.plot("RateOfChangePercent", "rocp", self._rocp.current.value)
            self.plot("Price ","Price", self._equity.close)
            if self.portfolio.invested:        
               pass
                #self.log("Invested")
            else: 
                #self.log("Not Invested")
                if self._rocp.current.value > 18:
                    self.log("Last Trade Profit: " + str(self.portfolio[self._symbol].last_trade_profit))
                    self.log("buying: " + self._symbol)
                    self.market_order(self._symbol, 1)
                    
                    self.log("Placing Trailing Stop Order")
                    self.trailing_stop_order(self._symbol, -1, 0.05, True) # self.securities[self._symbol].holdings.absolute_quantity

          #Calculate number of shares to be 100% of portfolio
        #quantity = self.calculate_order_quantity(self._symbol, 1)


              #  self.log("mom indicator: " + str(self._mom.current.value))
               # self.log("mom indicator percent change: " + str(self._mom.current.value / self._mom.previous.))
         #

           # self.log("Margin remaining: " + str(self.portfolio.margin_remaining))

           #### self.Plot("Asset Price", self.Securities[self._stock].Close)
            #self.debug("GME SHARES: " + str(self.securities[self._stock].holdings.absolute_quantity))