public static Stoch Stoch(this List <Candle> source, int fastKPeriod = 5, int slowKPeriod = 3, TicTacTec.TA.Library.Core.MAType slowKmaType = TicTacTec.TA.Library.Core.MAType.Sma, int slowDPeriod = 3, TicTacTec.TA.Library.Core.MAType slowDmaType = TicTacTec.TA.Library.Core.MAType.Sma) { int outBegIdx, outNbElement; double[] kValues = new double[source.Count]; double[] dValues = new double[source.Count]; var highs = source.Select(x => Convert.ToDouble(x.High)).ToArray(); var lows = source.Select(x => Convert.ToDouble(x.Low)).ToArray(); var closes = source.Select(x => Convert.ToDouble(x.Close)).ToArray(); var tema = TicTacTec.TA.Library.Core.Stoch(0, source.Count - 1, highs, lows, closes, fastKPeriod, slowKPeriod, slowKmaType, slowDPeriod, slowDmaType, out outBegIdx, out outNbElement, kValues, dValues); if (tema == TicTacTec.TA.Library.Core.RetCode.Success) { return(new Stoch() { D = FixIndicatorOrdering(dValues.ToList(), outBegIdx, outNbElement), K = FixIndicatorOrdering(kValues.ToList(), outBegIdx, outNbElement) }); } throw new Exception("Could not calculate STOCH!"); }
public BbandsOptions(int period, double devUp, double devDown, TicTacTec.TA.Library.Core.MAType type) { Period = period; DevUp = devDown; DevDown = devDown; Type = type; }
public StochOptions(int fastKPeriod, int slowKPeriod, TicTacTec.TA.Library.Core.MAType slowKmaType, int slowDPeriod, TicTacTec.TA.Library.Core.MAType slowDmaType) { FastKPeriod = fastKPeriod; SlowKPeriod = slowKPeriod; SlowKmaType = slowKmaType; SlowDPeriod = slowDPeriod; SlowDmaType = slowDmaType; }
public StochRsiOptions(int optInTimePeriod, ICandleVariableCode type, int fastKPeriod, int fastDPeriod, TicTacTec.TA.Library.Core.MAType fastDmaType) { OptInTimePeriod = optInTimePeriod; Type = type; FastDmaType = fastDmaType; FastKPeriod = fastKPeriod; FastDPeriod = fastDPeriod; }
public static Stoch StochRsi(this List <Candle> source, int optInTimePeriod = 14, CandleVariable type = CandleVariable.Close, int fastKPeriod = 5, int fastDPeriod = 3, TicTacTec.TA.Library.Core.MAType fastDmaType = TicTacTec.TA.Library.Core.MAType.Sma) { int outBegIdx, outNbElement; double[] kValues = new double[source.Count]; double[] dValues = new double[source.Count]; double[] valuesToCheck; switch (type) { case CandleVariable.Open: valuesToCheck = source.Select(x => x.Open).ToArray(); break; case CandleVariable.Low: valuesToCheck = source.Select(x => x.Low).ToArray(); break; case CandleVariable.High: valuesToCheck = source.Select(x => x.High).ToArray(); break; default: valuesToCheck = source.Select(x => x.Close).ToArray(); break; } var tema = TicTacTec.TA.Library.Core.StochRsi(0, source.Count - 1, valuesToCheck, optInTimePeriod, fastKPeriod, fastDPeriod, fastDmaType, out outBegIdx, out outNbElement, kValues, dValues); if (tema == TicTacTec.TA.Library.Core.RetCode.Success) { return(new Stoch() { D = FixIndicatorOrdering(dValues.ToList(), outBegIdx, outNbElement), K = FixIndicatorOrdering(kValues.ToList(), outBegIdx, outNbElement) }); } throw new Exception("Could not calculate STOCH!"); }
public static Bband Bbands(this List <Candle> source, int period = 5, double devUp = 2, double devDown = 2, TicTacTec.TA.Library.Core.MAType type = TicTacTec.TA.Library.Core.MAType.Sma) { int outBegIdx, outNbElement; double[] upperValues = new double[source.Count]; double[] middleValues = new double[source.Count]; double[] lowerValues = new double[source.Count]; var bbands = TicTacTec.TA.Library.Core.Bbands(0, source.Count - 1, source.Select(x => x.Close).ToArray(), period, devUp, devDown, type, out outBegIdx, out outNbElement, upperValues, middleValues, lowerValues); if (bbands == TicTacTec.TA.Library.Core.RetCode.Success) { return(new Bband() { UpperBand = FixIndicatorOrdering(upperValues.ToList(), outBegIdx, outNbElement), MiddleBand = FixIndicatorOrdering(middleValues.ToList(), outBegIdx, outNbElement), LowerBand = FixIndicatorOrdering(lowerValues.ToList(), outBegIdx, outNbElement) }); } throw new Exception("Could not calculate Bbands!"); }
public StochFastOptions(int fastKPeriod, int fastDPeriod, TicTacTec.TA.Library.Core.MAType fastDmaType) { FastDmaType = fastDmaType; FastKPeriod = fastKPeriod; FastDPeriod = fastDPeriod; }