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
-0.81
Tracking Error
0.1
Treynor Ratio
0
Total Fees
$0.00
from QuantConnect.Indicators import CommodityChannelIndex, Stochastic

class NotebookProject(QCAlgorithm):

    def Initialize(self):
        self.SetTimeZone("Europe/London")
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        
        self.SetStartDate(DateTime(2020, 6, 19))  #Set Start Date
        self.SetEndDate(self.StartDate + timedelta(3))          #Set End Date

        self.wticousd = self.AddCfd("WTICOUSD", Resolution.Minute, Market.Oanda)
        self.sto = Stochastic("WTICOUSD", 21, 21, 39)
        self.cci = CommodityChannelIndex("WTICOUSD", 200)
        
        thirtyMinuteConsolidator = QuoteBarConsolidator(timedelta(minutes=30))
        thirtyMinuteConsolidator.DataConsolidated += self.ThirtyMinuteQuoteBarHandler
        self.SubscriptionManager.AddConsolidator("WTICOUSD", thirtyMinuteConsolidator)
        
        self.SetWarmup(200*30, Resolution.Minute)
        
        
    def OnData(self, data):
        pass
    
    def ThirtyMinuteQuoteBarHandler(self, sender, consolidated):
        self.sto.Update(consolidated)
        self.cci.Update(consolidated)
        
        sto_value = self.sto.Current.Value
        cci_value = self.cci.Current.Value
        
        if self.IsWarmingUp:
            return 

        if self.Time.month == 6 and self.Time.day == 19 and self.Time.hour >= 20:
            self.Log(f'STO >> {sto_value} CCI >> {cci_value}  ')