public void Exceptions() { // insufficient history - month Assert.ThrowsException <BadHistoryException>(() => Indicator.GetPivotPoints(HistoryTestData.Get(18), PeriodSize.Month)); // insufficient history - week IEnumerable <Quote> w = HistoryTestData.Get(5) .OrderBy(x => x.Date).Take(4); Assert.ThrowsException <BadHistoryException>(() => Indicator.GetPivotPoints(w, PeriodSize.Week)); // insufficient history - day IEnumerable <Quote> d = HistoryTestData.GetIntraday(250); Assert.ThrowsException <BadHistoryException>(() => Indicator.GetPivotPoints(d, PeriodSize.Day)); // insufficient history - hour IEnumerable <Quote> h = HistoryTestData.GetIntraday(30) .OrderBy(x => x.Date).Take(29); Assert.ThrowsException <BadHistoryException>(() => Indicator.GetPivotPoints(h, PeriodSize.Hour)); }
public void DerivedIndicatorFind() { IEnumerable <Quote> history = HistoryTestData.Get(); IEnumerable <EmaResult> emaResults = Indicator.GetEma(history, 20); // can use a derive Indicator class using Linq IEnumerable <MyIndicator> myIndicatorResults = emaResults .Where(x => x.Ema != null) .Select(x => new MyIndicator { Id = 12345, Date = x.Date, MyEma = (float)x.Ema, MyProperty = false }); Assert.IsTrue(myIndicatorResults.Any()); // find specific date DateTime findDate = DateTime.ParseExact("2018-12-31", "yyyy-MM-dd", englishCulture); MyIndicator i = myIndicatorResults.Find(findDate); Assert.AreEqual(12345, i.Id); EmaResult r = emaResults.Find(findDate); Assert.AreEqual(249.3519m, Math.Round((decimal)r.Ema, 4)); }
public void PennyData() { IEnumerable <Quote> penny = HistoryTestData.GetPenny(); IEnumerable <HtlResult> r = Indicator.GetHtTrendline(penny); Assert.AreEqual(533, r.Count()); }
public void Exceptions() { // bad lookback period Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetCorrelation(history, historyOther, 0)); // insufficient history IEnumerable <Quote> h1 = HistoryTestData.Get(29); IEnumerable <Quote> h2 = HistoryTestData.GetCompare(29); Assert.ThrowsException <BadHistoryException>(() => Indicator.GetCorrelation(h1, h2, 30)); // bad eval history IEnumerable <Quote> eval = HistoryTestData.GetCompare(300); Assert.ThrowsException <BadHistoryException>(() => Indicator.GetCorrelation(history, eval, 30)); // mismatched history IEnumerable <Quote> historyMismatch = HistoryTestData.GetMismatchDates(); Assert.ThrowsException <BadHistoryException>(() => Indicator.GetCorrelation(historyMismatch, historyOther, 20)); }
public void ValidateHistory() { IEnumerable <Quote> history = HistoryTestData.Get(); history.Validate(); Indicator.GetSma(history, 5); }
public void ValidateHistoryOld() { IEnumerable <Quote> history = HistoryTestData.Get(); history = Cleaners.ValidateHistory(history); Indicator.GetSma(history, 5); }
public void ReadQuoteClass() { IEnumerable <Quote> history = HistoryTestData.Get(); IEnumerable <Quote> h = history.Validate(); Quote f = h.FirstOrDefault(); Console.WriteLine("Date:{0},Close:{1}", f.Date, f.Close); }
public void Bitcoin() { IEnumerable<Quote> h = HistoryTestData.GetBitcoin(); List<SuperTrendResult> results = Indicator.GetSuperTrend(h, 10, 3) .ToList(); Assert.AreEqual(1246, results.Count); SuperTrendResult r = results[1208]; Assert.AreEqual(16242.2704m, Math.Round((decimal)r.LowerBand, 4)); }
public void Exceptions() { // bad lookback period Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetSlope(history, 0)); // insufficient history Assert.ThrowsException <BadHistoryException>(() => Indicator.GetSlope(HistoryTestData.Get(29), 30)); }
public void Exceptions() { // bad lookback period Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetFractal(history, 1)); // insufficient history Assert.ThrowsException <BadHistoryException>(() => Indicator.GetFractal(HistoryTestData.Get(10), 5)); }
public void Exceptions() { // bad smoothing period Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetBop(history, 0)); // insufficient history Assert.ThrowsException <BadHistoryException>(() => Indicator.GetBop(HistoryTestData.Get(24), 25)); }
public void Exceptions() { // bad SMA period Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetAdl(history, 0)); // insufficient history Assert.ThrowsException <BadHistoryException>(() => Indicator.GetAdl(HistoryTestData.Get(1))); }
public void Exceptions() { // bad lookback period Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetZigZag(history, ZigZagType.Close, 0)); // insufficient history Assert.ThrowsException <BadHistoryException>(() => Indicator.GetZigZag(HistoryTestData.Get(1))); }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(6 * 20 + 100 + qty); IEnumerable <T3Result> r = Indicator.GetT3(h, 20); T3Result l = r.LastOrDefault(); Console.WriteLine("T3 on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.T3); } }
public void Mama() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(50 + qty); IEnumerable <MamaResult> r = Indicator.GetMama(h); MamaResult l = r.LastOrDefault(); Console.WriteLine("MAMA on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Mama); } }
public void StarcBands() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(200 + qty); IEnumerable <StarcBandsResult> r = Indicator.GetStarcBands(h, 100); StarcBandsResult l = r.LastOrDefault(); Console.WriteLine("STARC UPPER on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.UpperBand); } }
public void Atr() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(115 + qty); IEnumerable <AtrResult> r = Indicator.GetAtr(h); AtrResult l = r.LastOrDefault(); Console.WriteLine("ATR on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Atr); } }
public void Tsi() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(135 + qty); IEnumerable <TsiResult> r = Indicator.GetTsi(h); TsiResult l = r.LastOrDefault(); Console.WriteLine("TSI on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Tsi); } }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(15 + qty); IEnumerable <VortexResult> r = Indicator.GetVortex(h, 14); VortexResult l = r.LastOrDefault(); Console.WriteLine("VI+ on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Pvi); } }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(110 + qty); IEnumerable <ChaikinOscResult> r = Indicator.GetChaikinOsc(h); ChaikinOscResult l = r.LastOrDefault(); Console.WriteLine("CHAIKIN OSC on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Oscillator); } }
public void Adx() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(128 + qty); IEnumerable <AdxResult> r = h.GetAdx(); AdxResult l = r.LastOrDefault(); Console.WriteLine("ADX on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Adx); } }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(115 + qty); IEnumerable <EmaResult> r = Indicator.GetEma(h, 15); EmaResult l = r.LastOrDefault(); Console.WriteLine("EMA on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Ema); } }
public void Convergence() { foreach (int qty in convergeQuantities.Where(x => x <= 502)) { IEnumerable <Quote> h = HistoryTestData.Get(110 + qty); IEnumerable <StochRsiResult> r = Indicator.GetStochRsi(h, 14, 14, 3, 1); StochRsiResult l = r.LastOrDefault(); Console.WriteLine("SRSI on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.StochRsi); } }
public void Find() { IEnumerable <Quote> history = HistoryTestData.Get(); IEnumerable <EmaResult> emaResults = Indicator.GetEma(history, 20); // find specific date DateTime findDate = DateTime.ParseExact("2018-12-31", "yyyy-MM-dd", englishCulture); EmaResult r = emaResults.Find(findDate); Assert.AreEqual(249.3519m, Math.Round((decimal)r.Ema, 4)); }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(5 + qty); IEnumerable <FisherTransformResult> r = Indicator.GetFisherTransform(h, 10); FisherTransformResult l = r.LastOrDefault(); Console.WriteLine("FT on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Fisher); } }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(103 + qty); IEnumerable <ConnorsRsiResult> r = Indicator.GetConnorsRsi(h, 3, 2, 10); ConnorsRsiResult l = r.LastOrDefault(); Console.WriteLine("CRSI on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.ConnorsRsi); } }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(130 + qty); IEnumerable <PmoResult> r = Indicator.GetPmo(h); PmoResult l = r.LastOrDefault(); Console.WriteLine("PMO on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Pmo); } }
public void Convergence() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(200 + qty); IEnumerable <KeltnerResult> r = Indicator.GetKeltner(h, 100); KeltnerResult l = r.LastOrDefault(); Console.WriteLine("KC-UP on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.UpperBand); } }
public void HtTrendline() { foreach (int qty in convergeQuantities) { IEnumerable <Quote> h = HistoryTestData.GetLong(100 + qty); IEnumerable <HtlResult> r = Indicator.GetHtTrendline(h); HtlResult l = r.LastOrDefault(); Console.WriteLine("HTL on {0:d} with {1,4} periods: {2:N8}", l.Date, h.Count(), l.Trendline); } }
public void Exceptions() { // bad SMA period DateTime startDate = DateTime.ParseExact("2000-12-15", "yyyy-MM-dd", englishCulture); Assert.ThrowsException <ArgumentOutOfRangeException>(() => Indicator.GetVwap(history, startDate)); // insufficient history Assert.ThrowsException <BadHistoryException>(() => Indicator.GetVwap(HistoryTestData.Get(0))); }