| 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.153 Tracking Error 0.085 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class WarmupHistoryAlgorithm(QCAlgorithm):
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2014,5,2) #Set Start Date
self.SetEndDate(2014,5,10) #Set End Date
self.SetCash(100000) #Set Strategy Cash
spy = self.AddEquity("SPY", Resolution.Minute).Symbol
consolidator = TradeBarConsolidator(timedelta(minutes=5))
consolidator.DataConsolidated += self.UpdateIndicators
self.sma = self.SMA(spy, 200)
self.ao = self.AO(spy, 5, 34, MovingAverageType.Simple)
history = self.History(spy, 360, Resolution.Minute)
for time, row in history.loc[spy].iterrows():
tradebar = TradeBar(time, spy, row.open, row.high, row.low, row.close, row.volume)
consolidator.Update(tradebar)
def UpdateIndicators(self, sender, bar):
self.ao.Update(bar)
self.sma.Update(bar.EndTime, bar.Close)
self.Log(f'bar received on {bar.EndTime}')