Overall Statistics
Total Trades
7
Average Win
113.90%
Average Loss
0%
Compounding Annual Return
1251.214%
Drawdown
32.300%
Expectancy
0
Net Profit
878.756%
Sharpe Ratio
2.012
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
2.324
Beta
0.592
Annual Standard Deviation
1.188
Annual Variance
1.41
Information Ratio
1.92
Tracking Error
1.187
Treynor Ratio
4.034
Total Fees
$983.30
import numpy as np

### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    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(2017,01,01)  #Set Start Date
        self.SetEndDate(2017,11,15)    #Set End Date
        self.SetCash(10000)           #Set Strategy Cash

        self.SetBrokerageModel(BrokerageName.GDAX)
        self.AddCrypto("LTCUSD", Resolution.Daily)
        self.rsi_now = self.RSI("LTCUSD", 14,  MovingAverageType.Simple, Resolution.Daily)
        
        
        stockPlot = Chart('Trade Plot')
        # On the Trade Plotter Chart we want 3 series: trades and price:
        stockPlot.AddSeries(Series('RSI', SeriesType.Line, 0))
        self.AddChart(stockPlot)


    def OnData(self, data):

        if not self.rsi_now.IsReady or self.rsi_now.Current.Value == 100:
            return

        holdings = self.Portfolio.HoldStock
        #self.Log("Holdings: " + str(holdings))
        
        #self.Log("RSI: " + str(self.rsi_now.Current.Value))
        
        if holdings <= 0:
            if self.rsi_now.Current.Value < 50:
                self.SetHoldings("LTCUSD", 1.0)
                self.Log("IN: " + str(self.Securities["LTCUSD"].Price))
        
        elif self.rsi_now.Current.Value > 80:
                self.Liquidate("LTCUSD")
                self.Log("OUT: " + str(self.Securities["LTCUSD"].Price))
        
        # if not self.Portfolio.HoldStock and self.rsi_now.Current.Value < 30:
        #     self.SetHoldings("BTCUSD", 1) 
        #     self.Log("IN: " + str(self.Securities["BTCUSD"].Price))
        #     self.Log("Holdings: " + str(holdings))
        #     self.Log("RSI: " + str(self.rsi_now.Current.Value))
            
        # elif self.Portfolio.HoldStock and self.rsi_now.Current.Value > 80:
        #     self.Liquidate("BTCUSD")
        #     self.Log("OUT: " + str(self.Securities["BTCUSD"].Price))
        #     self.Log("Holdings: " + str(holdings))
        #     self.Log("RSI: " + str(self.rsi_now.Current.Value))
                
        self.Plot("Trade Plot", "RSI", self.rsi_now.Current.Value);