Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-4.257
Tracking Error
0.068
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
from AlgorithmImports import *
from datetime import datetime, date

class AlertLightBrownHyena(QCAlgorithm):

    def Initialize(self):
        self.ticker = 'SPY'
        self.startingCash = 100000
        self.startDate = '2023-07-01'
        self.endDate = '-'

        # Equities
        self.resolution = Resolution.Minute
        self.equity = self.AddEquity(self.ticker, self.resolution)
        #self.equity.SetDataNormalizationMode(DataNormalizationMode.Raw)

        # Backtesting
        self.SetStartDate(datetime.fromisoformat(self.startDate))
        self.SetEndDate(datetime.fromisoformat(self.endDate)) if self.endDate != '-' else self.SetEndDate(datetime.now())
        self.SetCash(self.startingCash)
        self.SetTimeZone("America/New_York")
        self.SetBenchmark(self.equity.Symbol)
        self.SetWarmUp(500)

        # Consolidators
        self.consolidator = self.Consolidate(self.equity.Symbol, timedelta(minutes=5), self.OnFiveMinData)

        # Indicators
        self.rsi = RelativeStrengthIndex(14, MovingAverageType.Simple)
        self.RegisterIndicator(self.equity.Symbol, self.rsi, self.consolidator)
        self.rsiSMA = IndicatorExtensions.SMA(self.rsi, 14)

    def OnFiveMinData(self, data):
        self.Log(f"Close: {round(data.Close, 2)}, RSI: {round(self.rsi.Current.Value, 2)}, RSI SMA: {round(self.rsiSMA.Current.Value, 2)}")