Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-3.130%
Drawdown
13.500%
Expectancy
0
Net Profit
-13.358%
Sharpe Ratio
-0.58
Probabilistic Sharpe Ratio
0.000%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.022
Beta
0.007
Annual Standard Deviation
0.036
Annual Variance
0.001
Information Ratio
-0.698
Tracking Error
0.183
Treynor Ratio
-3.218
Total Fees
$0.00
Estimated Strategy Capacity
$830000.00
Lowest Capacity Asset
ETHUSD XJ
Portfolio Turnover
0.05%
from AlgorithmImports import *
# 4h RSI btc algo. 100sma trend. THEN make one that sorts too

class DeterminedSkyBlueDinosaur(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 3, 4)
        self.SetCash(100000)
        self.ticker=self.AddCrypto("ETHUSD", Resolution.Minute)
        self.rsi=self.RSI(self.ticker.Symbol, 14, Resolution.Minute)
        self.TREND=self.SMA(self.ticker.Symbol, 9, Resolution.Daily)
        
        mins_in_day=24*60
        warmup_days=9
        warmup_time=mins_in_day*warmup_days
        self.SetWarmup(warmup_time)

        consolidator = TradeBarConsolidator((timedelta(minutes=60)))
        consolidator.DataConsolidated += self.OnDataConsolidated
        self.SubscriptionManager.AddConsolidator(self.ticker.Symbol, consolidator)

        self.prev_rsi_value=None


    def OnDataConsolidated(self, sender, bar):
        self.rsi.Update(bar.EndTime, bar.Close)

        if self.IsWarmingUp:
            return
        if not self.ticker.Price > self.TREND.Current.Value:
            return
        
        rsi_value=self.rsi.Current.Value
        trade_quantity=int(self.Portfolio.Cash/self.ticker.Price)*0.9

        if self.prev_rsi_value is None:
            self.prev_rsi_value=rsi_value

        if not self.Portfolio.Invested:
            if 5<rsi_value<21 and rsi_value>self.prev_rsi_value:
                self.MarketOrder(self.ticker.Symbol, trade_quantity)
                self.StopMarketOrder(self.ticker.Symbol, -trade_quantity,self.ticker.Price*0.8)

        if self.Portfolio.Invested:
            if rsi_value>90:
                self.Liquidate()
        
        self.prev_rsi_value=rsi_value