//****************************************** protected override void Initialize() { //************************************** LR_Slope = Indicators.LinearRegressionSlope(MarketSeries.Close, 12); MA20 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 20); MA50 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 50); MA100 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 100); LTF_Candle = MarketData.GetSeries(LTF); MTF_Candle = MarketData.GetSeries(MTF); STF_Candle = MarketData.GetSeries(STF); //************************************** /////////////////////////////////////////////////////////// // Initialize and create nested indicators MA = Indicators.MovingAverage(MarketSeries.Close, MA_Periods, MovingAverageType.Exponential); // Initalize RSI RSI = Indicators.RelativeStrengthIndex(MarketSeries.Close, RSI_Periods); // Initalize CCI CCI = Indicators.CommodityChannelIndex(MarketSeries, CCI_Periods); thecount = MarketSeries.Close.Count; Print("theCount = " + thecount); }
protected override void Initialize() { // Initialize and create nested indicators CCI = Indicators.CommodityChannelIndex(CCI_Period); atr = CreateDataSeries(); tr = CreateDataSeries(); tri = Indicators.TrueRange(); }
/* * //获取指标趋势 * private int GetIndicatorsTrend(string[] data) * { * if (data.Length < 2) * { * return 0; * } * * for (var i = data.Length - 2; i >= 0; i--) * { * string[] tmp_str_arr = data[i].Split('|'); * double tmp_val = Convert.ToDouble(tmp_str_arr[1]); * * if (curr_rsi_val - tmp_val > difference_of_trend) * { * //上行趋势 * return 2; * } * * if (curr_rsi_val - tmp_val < difference_of_trend) * { * //下行趋势 * return 1; * } * } * * return 0; * } */ //返回指标最近num个值,结果为数组 private string[] GetIndicatorsLatestData(string indicator, int num = 0) { string[] res = new string[0]; int len = 0; int index = 0; if (indicator == "cci") { var idtr = Indicators.CommodityChannelIndex(PeriodsCci); len = idtr.Result.Count; if (num > 0 && num > len) { num = len; } else if (num == 0) { num = len; } res = new string[num]; for (var i = len - num; i < len; i++) { res[index] = GetCurrTimeStamp().ToString() + "|" + idtr.Result[i].ToString(); index++; } } else if (indicator == "rsi") { var idtr = Indicators.RelativeStrengthIndex(MarketSeries.Close, PeriodsRsi); len = idtr.Result.Count; if (num > 0 && num > len) { num = len; } else if (num == 0) { num = len; } res = new string[num]; for (var i = len - num; i < len; i++) { res[index] = GetCurrTimeStamp().ToString() + "|" + idtr.Result[i].ToString(); index++; } } return(res); }
protected override void OnStart() { base.OnStart(); botLabel = string.Format("{0}-{1} {2}", botPrefix, Symbol.Code, TimeFrame); Print(this.botName()); wpr = Indicators.GetIndicator <WilliamsPercentRange>(wprSource, wprPeriod, wprOverbuyCeil, wprOversellCeil, WprMagicNumber, wprMinMaxPeriod, wprExceedMinMax); // ZigZag Kwan MBFX Timing ou Beta zigzagKwanMBFXTiming = Indicators.GetIndicator <ZigzagKwanMBFXTiming>(mbfxLen, mbfxFilter); zigZag = Indicators.GetIndicator <ZigZag>(ZzDepth, ZzDeviation, ZzBackStep); trendMagic = Indicators.GetIndicator <TrendMagic>(TMCciPeriod, TMAtrPeriod); _cci = Indicators.CommodityChannelIndex(TMCciPeriod); Positions.Opened += OnPositionOpened; Positions.Closed += OnPositionClosed; }
protected override void Initialize() { cci = Indicators.CommodityChannelIndex(CciPeriod); }
protected override void Initialize() { cci = Indicators.CommodityChannelIndex(Period); value1 = CreateDataSeries(); }
protected override void Initialize() { cci = Indicators.CommodityChannelIndex(CCI_period); cciline = Indicators.CommodityChannelIndex(CCI_period); }
protected override void OnStart() { _cci = Indicators.CommodityChannelIndex(Periods); }
protected override void OnStart() { i_MACD = Indicators.MacdHistogram(MarketSeries.Close, (int)_MACD_Slow_EMA, (int)_MACD_Fast_EMA, (int)_MACD_Signal); i_CCI_0 = Indicators.CommodityChannelIndex((int)_CCI_Period); i_CCI_1 = Indicators.CommodityChannelIndex((int)_CCI_Period); }