Overall Statistics
Total Trades
34
Average Win
2.90%
Average Loss
-3.04%
Compounding Annual Return
21.364%
Drawdown
17.400%
Expectancy
0.150
Net Profit
6.670%
Sharpe Ratio
0.752
Probabilistic Sharpe Ratio
41.911%
Loss Rate
41%
Win Rate
59%
Profit-Loss Ratio
0.96
Alpha
0.109
Beta
0.243
Annual Standard Deviation
0.234
Annual Variance
0.055
Information Ratio
-0.397
Tracking Error
0.249
Treynor Ratio
0.723
Total Fees
$68428.76
Estimated Strategy Capacity
$560000.00
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")

from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
from QuantConnect.Data.Market import TradeBar

class RollingWindowAlgorithm(QCAlgorithm):

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2021,1,1)  #Set Start Date
        self.SetCash(1000000)           #Set Strategy Cash

        self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute,Market.GDAX).Symbol

#################################
        self.SetBrokerageModel(BrokerageName.AlphaStreams)

 ##################################################### 
        self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday),    self.TimeRules.AfterMarketOpen(self.symbol,1),     self.Compra)
                        
        self.Schedule.On(self.DateRules.EveryDay(),                 self.TimeRules.BeforeMarketClose(self.symbol,1),   self.Vende)                
                    
                     
      #########################################################################################
  
  
 ### ENTRY & EXIT ---------------------------------------------------------------------------------
    def Compra(self):
        if not self.Portfolio.Invested:
                self.SetHoldings(self.symbol, 1)

    def Vende(self):
        if self.Portfolio.Invested:
            self.Liquidate()