/// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> /// <seealso cref="QCAlgorithm.SetStartDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetEndDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetCash(decimal)"/> public override void Initialize() { // mylog.Debug(",CurrentBar,Time,Price,smooth,low,i1,cycle0,cycle1,cycle2,fish,medianDelta,DC,instaperiod, v2,DCPeriod,realpart,imagpart,dcphase"); mylog.Debug(ondataheader); //mylog.Debug(",Time,CurrentBar,Direction,TradeProfit,,Price,Profit,HoldingCost,FillQty,Fees,TransAmt"); //mylog.Debug(transheader); //Initialize SetStartDate(2015, 05, 12); SetEndDate(2015, 05, 12); SetCash(25000); //Add as many securities as you like. All the data will be passed into the event handler: AddSecurity(SecurityType.Equity, _symbol, Resolution.Minute); _indicators = new AlgoIndicators { //BB = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily), RSI = RSI(_symbol, 14, MovingAverageType.Simple, Resolution.Daily), //ATR = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily), //EMA = EMA(_symbol, 14, Resolution.Daily), //SMA = SMA(_symbol, 14, Resolution.Daily), MACD = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Minute) //AROON = AROON(_symbol, 20, Resolution.Daily), //MOM = MOM(_symbol, 20, Resolution.Daily), //MOMP = MOMP(_symbol, 20, Resolution.Daily), //STD = STD(_symbol, 20, Resolution.Daily), //MIN = MIN(_symbol, 14, Resolution.Daily), // by default if the symbol is a tradebar type then it will be the min of the low property //MAX = MAX(_symbol, 14, Resolution.Daily), // by default if the symbol is a tradebar type then it will be the max of the high property //open = new WindowIndicator<IndicatorDataPoint>(4) //Ft = FT(_symbol, samplesize, Resolution.Minute), //Rvi = RVI(_symbol, samplesize, Resolution.Minute) }; //open = new RollingWindow<IndicatorDataPoint>(samplesize); //close = new RollingWindow<IndicatorDataPoint>(samplesize); //high = new RollingWindow<IndicatorDataPoint>(samplesize); //low = new RollingWindow<IndicatorDataPoint>(samplesize); //i1 = new RollingWindow<IndicatorDataPoint>(samplesize); //instperiod = new RollingWindow<IndicatorDataPoint>(samplesize); //v2 = new RollingWindow<IndicatorDataPoint>(samplesize); //v1 = new RollingWindow<IndicatorDataPoint>(samplesize); //Rvi = new RollingWindow<IndicatorDataPoint>(samplesize); unrealized = new RollingWindow<IndicatorDataPoint>(samplesize); iFishes = new RollingWindow<IndicatorDataPoint>(samplesize); RsiHistory = new RollingWindow<IndicatorDataPoint>(samplesize); //Signal = new RollingWindow<IndicatorDataPoint>(samplesize); //maxRvi = new Maximum("RVI_Max", samplesize); //minRvi = new Minimum("RVi_Min", samplesize); //maxSignal = new Maximum("Sig_Max", samplesize); //minSignal = new Minimum("Sig_Min", samplesize); fish = new FisherTransform(samplesize); ifish = new InverseFisherTransform(samplesize); //Crossing = new RollingWindow<IndicatorDataPoint>(samplesize); //FisherHistory = new RollingWindow<IndicatorDataPoint>(samplesize); Rvi = new RelativeVigorIndex(_symbol, samplesize); for (int x = 0; x < samplesize; x++) { //open.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //close.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //high.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //low.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //i1.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //instperiod.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //v1.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //v2.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //Rvi.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); unrealized.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); iFishes.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //Signal.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //Crossing.Add(new IndicatorDataPoint(DateTime.MinValue, .0001m)); } }
/// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// </summary> /// <seealso cref="QCAlgorithm.SetStartDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetEndDate(System.DateTime)"/> /// <seealso cref="QCAlgorithm.SetCash(decimal)"/> public override void Initialize() { // mylog.Debug(",CurrentBar,Time,Price,smooth,low,i1,cycle0,cycle1,cycle2,fish,medianDelta,DC,instaperiod, v2,DCPeriod,realpart,imagpart,dcphase"); mylog.Debug(ondataheader); //mylog.Debug(",Time,CurrentBar,Direction,TradeProfit,,Price,Profit,HoldingCost,FillQty,Fees,TransAmt"); //mylog.Debug(transheader); //Initialize SetStartDate(2015, 05, 12); SetEndDate(2015, 05, 12); SetCash(25000); //Add as many securities as you like. All the data will be passed into the event handler: AddSecurity(SecurityType.Equity, _symbol, Resolution.Minute); _indicators = new AlgoIndicators { //BB = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily), RSI = RSI(_symbol, 14, MovingAverageType.Simple, Resolution.Daily), //ATR = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily), //EMA = EMA(_symbol, 14, Resolution.Daily), //SMA = SMA(_symbol, 14, Resolution.Daily), MACD = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Minute) //AROON = AROON(_symbol, 20, Resolution.Daily), //MOM = MOM(_symbol, 20, Resolution.Daily), //MOMP = MOMP(_symbol, 20, Resolution.Daily), //STD = STD(_symbol, 20, Resolution.Daily), //MIN = MIN(_symbol, 14, Resolution.Daily), // by default if the symbol is a tradebar type then it will be the min of the low property //MAX = MAX(_symbol, 14, Resolution.Daily), // by default if the symbol is a tradebar type then it will be the max of the high property //open = new WindowIndicator<IndicatorDataPoint>(4) //Ft = FT(_symbol, samplesize, Resolution.Minute), //Rvi = RVI(_symbol, samplesize, Resolution.Minute) }; //open = new RollingWindow<IndicatorDataPoint>(samplesize); //close = new RollingWindow<IndicatorDataPoint>(samplesize); //high = new RollingWindow<IndicatorDataPoint>(samplesize); //low = new RollingWindow<IndicatorDataPoint>(samplesize); //i1 = new RollingWindow<IndicatorDataPoint>(samplesize); //instperiod = new RollingWindow<IndicatorDataPoint>(samplesize); //v2 = new RollingWindow<IndicatorDataPoint>(samplesize); //v1 = new RollingWindow<IndicatorDataPoint>(samplesize); //Rvi = new RollingWindow<IndicatorDataPoint>(samplesize); unrealized = new RollingWindow <IndicatorDataPoint>(samplesize); iFishes = new RollingWindow <IndicatorDataPoint>(samplesize); RsiHistory = new RollingWindow <IndicatorDataPoint>(samplesize); //Signal = new RollingWindow<IndicatorDataPoint>(samplesize); //maxRvi = new Maximum("RVI_Max", samplesize); //minRvi = new Minimum("RVi_Min", samplesize); //maxSignal = new Maximum("Sig_Max", samplesize); //minSignal = new Minimum("Sig_Min", samplesize); fish = new FisherTransform(samplesize); ifish = new InverseFisherTransform(samplesize); //Crossing = new RollingWindow<IndicatorDataPoint>(samplesize); //FisherHistory = new RollingWindow<IndicatorDataPoint>(samplesize); Rvi = new RelativeVigorIndex(_symbol, samplesize); for (int x = 0; x < samplesize; x++) { //open.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //close.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //high.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //low.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //i1.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //instperiod.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //v1.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //v2.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //Rvi.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); unrealized.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); iFishes.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //Signal.Add(new IndicatorDataPoint(DateTime.MinValue, 0m)); //Crossing.Add(new IndicatorDataPoint(DateTime.MinValue, .0001m)); } }