Overall Statistics
Total Trades
2
Average Win
0%
Average Loss
-8.59%
Compounding Annual Return
-70.309%
Drawdown
20.200%
Expectancy
-1
Net Profit
-8.591%
Sharpe Ratio
-1.082
Probabilistic Sharpe Ratio
13.839%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.483
Beta
-1.088
Annual Standard Deviation
0.662
Annual Variance
0.438
Information Ratio
-1.253
Tracking Error
0.742
Treynor Ratio
0.658
Total Fees
$11.10
class TransdimensionalResistanceFlange(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 8, 6)  # Set Start Date
        
        self.SetEndDate(2019, 9, 1)
        self.SetCash(100000)  # Set Strategy Cash
        future = self.AddFuture("GC")
        future.SetFilter(0, 150)
        
        self.contract = None
        
        self.SetSecurityInitializer(lambda security : security.SetMarketPrice(self.GetLastKnownPrice(security)))

    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''
        

        if self.contract is None:
            for chain in data.FutureChains:
                contracts = [c for c in chain.Value]
                aug_expiry = [c.Symbol for c in contracts if c.Expiry.month == 8]
                
                if(len(aug_expiry)>0):
                
                    self.contract = aug_expiry[0]
                    
                    self.MarketOrder(self.contract, 3)
                    self.StopMarketOrder(self.contract, -3, 1432.30)
    
    def OnOrderEvent(self, orderEvent):
        
        self.Debug(f"Order Event: {orderEvent}  Symbol: {orderEvent.Symbol} , Market Price: {self.Securities[orderEvent.Symbol].Price}")