Created with Highcharts 12.1.2EquityJan 2017Jan…Feb 2017Mar 2017Apr 2017May 2017Jun 2017Jul 2017Aug 2017Sep 2017Oct 2017Nov 2017Dec 2017Jan 2018800k1,000k1,200k-10-50012012025M50M498k500k502k202530
Overall Statistics
Total Orders
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
9.626%
Drawdown
7.800%
Expectancy
0
Start Equity
1000000
End Equity
1095611.18
Net Profit
9.561%
Sharpe Ratio
0.505
Sortino Ratio
0.657
Probabilistic Sharpe Ratio
32.727%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.111
Beta
1.266
Annual Standard Deviation
0.111
Annual Variance
0.012
Information Ratio
-0.877
Tracking Error
0.087
Treynor Ratio
0.044
Total Fees
$113.45
Estimated Strategy Capacity
$29000000.00
Lowest Capacity Asset
MWD R735QTJ8XC9X
Portfolio Turnover
0.28%
from AlgorithmImports import *

class BuyAndHoldMSXOM(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2017, 1, 1)
        self.SetEndDate(2018, 1, 1)
        self.SetCash(1000_000)  # Start with $1M
        
        self.ms = self.AddEquity("MS", Resolution.Daily).Symbol
        self.xom = self.AddEquity("XOM", Resolution.Daily).Symbol
        self.bought = False

    def OnData(self, data):
        if not self.bought and self.ms in data and self.xom in data:
            self.SetHoldings(self.ms, 0.5) 
            self.SetHoldings(self.xom, 0.5) 
            self.bought = True
            self.Debug(f"Bought MS at {data[self.ms].Close} and XOM at {data[self.xom].Close}")