| Overall Statistics |
|
Total Trades 268 Average Win 0.20% Average Loss -0.03% Compounding Annual Return -61.892% Drawdown 2.400% Expectancy -0.340 Net Profit -1.052% Sharpe Ratio -5.779 Loss Rate 90% Win Rate 10% Profit-Loss Ratio 5.89 Alpha 0 Beta -47.909 Annual Standard Deviation 0.092 Annual Variance 0.008 Information Ratio -5.895 Tracking Error 0.092 Treynor Ratio 0.011 Total Fees $894.78 |
### <summary>
### Demonstration algorthm for the Warm Up feature with basic indicators.
### </summary>
### <meta name="tag" content="indicators" />
### <meta name="tag" content="warm up" />
### <meta name="tag" content="history and warm up" />
### <meta name="tag" content="using data" />
class WarmupAlgorithm(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(2013,10,8) #Set Start Date
self.SetEndDate(2013,10,11) #Set End Date
self.SetCash(100000) #Set Strategy Cash
# Find more symbols here: http://quantconnect.com/data
self.AddEquity("SPY", Resolution.Second)
fast_period = 60
slow_period = 3600
self.fast = self.EMA("SPY", fast_period)
self.slow = self.EMA("SPY", slow_period)
self.SetWarmup(slow_period)
self.first = True
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
if self.first and not self.IsWarmingUp:
self.first = False
self.Log("Fast: {0}".format(self.fast.Samples))
self.Log("Slow: {0}".format(self.slow.Samples))
if self.fast.Current.Value > self.slow.Current.Value:
self.SetHoldings("SPY", 1)
else:
self.SetHoldings("SPY", -1)