Overall Statistics
Total Trades
728
Average Win
0.55%
Average Loss
-0.30%
Compounding Annual Return
109.424%
Drawdown
16.200%
Expectancy
0.058
Net Profit
6.695%
Sharpe Ratio
1.92
Probabilistic Sharpe Ratio
53.670%
Loss Rate
62%
Win Rate
38%
Profit-Loss Ratio
1.81
Alpha
1.322
Beta
-0.442
Annual Standard Deviation
0.622
Annual Variance
0.387
Information Ratio
1.434
Tracking Error
0.631
Treynor Ratio
-2.701
Total Fees
$0.00
Estimated Strategy Capacity
$650000.00
Lowest Capacity Asset
BTCUSD XJ
# Blackpanther Fractal Indicator (window)

import numpy as np

class PensiveAsparagusHornet(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 4, 5)
        self.SetEndDate(2021, 5, 6) 
        self.SetCash(100000)  
        self.crypto = self.AddCrypto("BTCUSD", Resolution.Hour, Market.GDAX).Symbol
        self.window = RollingWindow[TradeBar](2)
        self.signal = 0 
        

    def OnData(self, data: Slice):
        if not self.crypto in data.Bars: return
        self.window.Add(data.Bars[self.crypto])
        if not self.window.IsReady: return

        H = np.flipud(np.array([self.window[i].High for i in range(2)]))
        L = np.flipud(np.array([self.window[i].Low for i in range(2)]))

        upFractal = (L[-1] <= L[-2])
        dnFractal = (H[-1] >= H[-2])

        if upFractal and not dnFractal: self.signal = 1
        elif not upFractal and dnFractal: self.signal = -1 
        
        self.Plot("Indicator", "signal", self.signal)
        self.Plot("Indicator", "zero", 0)
        
        self.SetHoldings(self.crypto, self.signal)