| Overall Statistics |
|
Total Trades 2 Average Win 0% Average Loss 0% Compounding Annual Return -34.846% Drawdown 29.200% Expectancy 0 Net Profit -19.297% Sharpe Ratio -1.12 Probabilistic Sharpe Ratio 5.837% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0.995 Annual Standard Deviation 0.336 Annual Variance 0.113 Information Ratio 0.22 Tracking Error 0.007 Treynor Ratio -0.378 Total Fees $2.68 |
namespace QuantConnect.Algorithm.CSharp
{
public class TachyonResistanceChamber : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2019, 9, 16); //Set Start Date
SetCash(100000); //Set Strategy Cash
// AddEquity("SPY", Resolution.Minute);
SetExecution(new ImmediateExecutionModel());
SetPortfolioConstruction(new EqualWeightingPortfolioConstructionModel());
UniverseSettings.Resolution = Resolution.Minute;
var symbols = new[] { QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA) };
SetUniverseSelection( new ManualUniverseSelectionModel(symbols) );
SetAlpha(new MyAlpha());
}
}
public class MyAlpha : AlphaModel
{
InsightCollection symbolInsights;
List<Symbol> symbols;
public MyAlpha(){
symbolInsights = new InsightCollection();
symbols = new List<Symbol>();
}
public override IEnumerable<Insight> Update(QCAlgorithm algorithm, Slice data){
var insights = new List<Insight>();
var activeInsights = symbolInsights.GetActiveInsights(algorithm.UtcTime);
foreach(var symbol in symbols){
if(!activeInsights.Select(x => x.Symbol).Contains(symbol)){
var insight = Insight.Price(symbol, TimeSpan.FromDays(2), InsightDirection.Up, null, 100, null, null);
insights.Add(insight);
symbolInsights.Add(insight);
}
}
return insights;
}
public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
{
foreach (var symbol in changes.AddedSecurities.Select(x => x.Symbol))
{
if (symbols.Contains(symbol)) continue;
symbols.Add(symbol);
}
}
}
}