public override void Initialize() { var res = TimeSpan.FromHours(1); if (VOL_PROTECT) { AddEquity("VIXM", Resolution.Hour); } foreach (var s in symbols) { AddEquity(s, Resolution.Minute).SetLeverage(2); pfe[s] = new PolarisedFractalEfficiency(); Algo.RegisterIndicator(s, pfe[s], res); ppfe[s] = 0; eit[s] = new EhlerInstantaneousTrend(); Algo.RegisterIndicator(s, eit[s], res); pvalue[s] = 0; activate[s] = false; // if (riskProtectSymbols.Contains(s)) // { // prevPerf[s] = 1; // reference[s] = 1; // _pfeReference[s] = new PolarisedFractalEfficiency(); // } } }
public static bool Activate(string strategy, decimal pnl, EhlerInstantaneousTrend indicator) { var day = indicator.Current.EndTime.Day; if (_pday != day) { _pday = day; if (pnl > Math.Max(indicator.Lag, indicator.InstantaneousTrend)) // || indicator > 0) { _activated.Add(strategy); } else { _activated.Remove(strategy); } } var value = _activated.Contains(strategy); return(value); }
public override void Initialize() { /*SetStartDate(2020, 1, 1); * if (LATEST_DEPLOY) SetStartDate(2021, 2, 6); */ //SetStartDate(2016, 1, 1); //SetEndDate(2021, 3, 15); //Set Start Date // SetStartDate(2011, 2, 1); // SetEndDate(2020, 1, 15); POS_COUNT = symbols.Count(); POS_COUNT -= (symbols.Contains("VXX")) ? 1: 0; POS_COUNT -= (symbols.Contains("VXX.1")) ? 1: 0; //CASH = Math.Max(10000*POS_COUNT, 20000);//Max for when testing VXX only //CASH = 145886; if (LATEST_DEPLOY) { CASH = 179860; } //SetCash(CASH); //Set Strategy Cash //SetStartDate(2018, 3, 1); //Set Start Date // if (symbols.Count() > 5) // { // //symbols.UnionWith(Universes.SP500); // symbols.UnionWith(Universes.NDX); // symbols.UnionWith(Universes.NDX99); // } //SetWarmup(TimeSpan.FromDays(stockPickingPeriod*4)); var res = TimeSpan.FromHours(1); if (VOL_PROTECT) { AddEquity("VIXM", Resolution.Hour); } foreach (var s in symbols) { AddEquity(s, Resolution.Minute).SetLeverage(2); pfe[s] = new PolarisedFractalEfficiency(); Algo.RegisterIndicator(s, pfe[s], res); ppfe[s] = 0; eit[s] = new EhlerInstantaneousTrend(); Algo.RegisterIndicator(s, eit[s], res); pvalue[s] = 0; activate[s] = false; // if (riskProtectSymbols.Contains(s)) // { // prevPerf[s] = 1; // reference[s] = 1; // _pfeReference[s] = new PolarisedFractalEfficiency(); // } } }