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.847 Tracking Error 0.151 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class MovingAverageCrossAlgorithm(QCAlgorithm): '''In this example we look at the canonical 15/30 day moving average cross. This algorithm will go long when the 15 crosses above the 30 and will liquidate when the 15 crosses back below the 30.''' def __init__(self): self.symbol = "BTCUSD" self.previous = None self.fast = None self.slow = None 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(2009, 1, 1) #Set Start Date self.SetEndDate(2015, 1, 1) #Set End Date self.SetCash(100000) #Set Strategy Cash # Find more symbols here: http://quantconnect.com/data self.AddSecurity(SecurityType.Crypto, self.symbol, Resolution.Minute) self.fast = self.EMA(self.symbol, 3, Resolution.Minute); self.slow = self.EMA(self.symbol, 7, Resolution.Minute); self.superslow = self.EMA(self.symbol, 15, Resolution.Minute); def OnData(self, data): tolerance = 0.00015; if self.Portfolio[self.symbol].Quantity <= 0 and self.fast.Current.Value > self.slow.Current.Value: self.SetHoldings(self.symbol, 1.0) if self.Portfolio[self.symbol].Quantity > 0 and self.Securities[self.symbol].Open != self.Securities[self.symbol].Close: self.Liquidate() if self.fast.Current.Value < self.slow.Current.Value: return