public void ComparesWithExternalDataDelayedKijunSenkouA() { var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26); TestHelper.TestIndicator( ichimoku, "spy_with_ichimoku.csv", "DelayedKijunSenkouA", (ind, expected) => Assert.AreEqual(expected, (double)((IchimokuKinkoHyo)ind).DelayedKijunSenkouA.Current.Value) ); }
public void ComparesAgainstExternalDataOnStochasticsK() { var stochastics = new Stochastic("sto", 12, 3, 5); const double epsilon = 1e-3; TestHelper.TestIndicator(stochastics, "spy_with_stoch12k3.txt", "Stochastics 12 %K 3", (ind, expected) => Assert.AreEqual(expected, (double)((Stochastic)ind).StochK.Current.Value, epsilon) ); }
public void ComparesAgainstExternalData() { var onBalanceVolumeIndicator = new OnBalanceVolume("OBV"); TestHelper.TestIndicator(onBalanceVolumeIndicator, "spy_with_obv.txt", "OBV", (ind, expected) => Assert.AreEqual( expected.ToString("0.##E-00"), (onBalanceVolumeIndicator.Current.Value).ToString("0.##E-00") ) ); }
public void ComparesAgainstExternalData() { var adx = new AverageDirectionalIndex("adx", 14); const double epsilon = 1; TestHelper.TestIndicator(adx, "spy_with_adx.txt", "ADX 14", (ind, expected) => Assert.AreEqual(expected, (double)((AverageDirectionalIndex)ind).Current.Value, epsilon) ); }
public void ComparesWithExternalDataTenkanMaximum() { var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26); TestHelper.TestIndicator( ichimoku, "spy_with_ichimoku.csv", "TenkanMaximum", (ind, expected) => Assert.AreEqual(expected, (double)((IchimokuKinkoHyo)ind).TenkanMaximum.Current.Value) ); }
public void PrimaryOutputIsFastStochProperty() { TestHelper.TestIndicator( CreateIndicator(), TestFileName, "Stochastics 12 %K 3", (ind, expected) => Assert.AreEqual( (double)((Stochastic)ind).FastStoch.Current.Value, ind.Current.Value ) ); }
public void ComparesTimeStampBetweenKeltnerChannelAndMiddleBand() { TestHelper.TestIndicator( CreateIndicator(), TestFileName, "Middle Band", (ind, expected) => Assert.AreEqual( ((KeltnerChannels)ind).Current.EndTime, ((KeltnerChannels)ind).MiddleBand.Current.EndTime ) ); }
public void ComparesWithExternalDataKijun() { var ichimoku = new IchimokuKinkoHyo("Ichimoku", 9, 26, 26, 52, 26, 26); ichimoku.Current.Time.ToString(); TestHelper.TestIndicator( ichimoku, "spy_with_ichimoku.csv", "Kijun", (ind, expected) => Assert.AreEqual(expected, (double)((IchimokuKinkoHyo)ind).Kijun.Current.Value) ); }
public void ComparesWithExternalDataUpperBand() { var abands = CreateIndicator(); TestHelper.TestIndicator( abands, "spy_acceleration_bands_20_4.txt", "UpperBand", (ind, expected) => Assert.AreEqual(expected, (double)((AccelerationBands)ind).UpperBand.Current.Value, delta: 1e-4, message: "Upper band test fail.") ); }
public void ComparesAgainstExternalDataOnStochasticsK() { TestHelper.TestIndicator( CreateIndicator(), TestFileName, "Stochastics 12 %K 3", (ind, expected) => Assert.AreEqual( expected, (double)((Stochastic)ind).StochK.Current.Value, 1e-3 ) ); }
public void ComparesWithExternalDataLowerBand() { TestHelper.TestIndicator( CreateIndicator(), TestFileName, "Keltner Channels 20 Bottom", (ind, expected) => Assert.AreEqual( expected, (double)((KeltnerChannels)ind).LowerBand.Current.Value, 1e-3 ) ); }
public override void ComparesAgainstExternalData() { const double epsilon = .0001; var adx = CreateIndicator(); TestHelper.TestIndicator(adx, TestFileName, "+DI14", (ind, expected) => Assert.AreEqual(expected, (double)((AverageDirectionalIndex)ind).PositiveDirectionalIndex.Current.Value, epsilon) ); adx.Reset(); TestHelper.TestIndicator(adx, TestFileName, "-DI14", (ind, expected) => Assert.AreEqual(expected, (double)((AverageDirectionalIndex)ind).NegativeDirectionalIndex.Current.Value, epsilon) ); }
public void ComparesWithExternalDataMacdSignal() { var macd = CreateIndicator(); TestHelper.TestIndicator( macd, TestFileName, "Signal", (ind, expected) => Assert.AreEqual( expected, (double)((MovingAverageConvergenceDivergence)ind).Signal.Current.Value, delta: 1e-4 ) ); }
/// <summary> /// Executes a test of the specified indicator /// </summary> protected virtual void RunTestIndicator(IndicatorBase <T> indicator) { if (indicator is IndicatorBase <IndicatorDataPoint> ) { TestHelper.TestIndicator(indicator as IndicatorBase <IndicatorDataPoint>, TestFileName, TestColumnName, Assertion as Action <IndicatorBase <IndicatorDataPoint>, double>); } else if (indicator is IndicatorBase <TradeBar> ) { TestHelper.TestIndicator(indicator as IndicatorBase <TradeBar>, TestFileName, TestColumnName, Assertion as Action <IndicatorBase <TradeBar>, double>); } else { throw new NotSupportedException("RunTestIndicator: Unsupported indicator data type: " + typeof(T)); } }
public void ComparesWithExternalDataSignal() { var tsi = CreateIndicator(); TestHelper.TestIndicator( tsi, TestFileName, "Signal_7", (ind, expected) => Assert.AreEqual( expected, (double)((TrueStrengthIndex)ind).Signal.Current.Value, delta: 1e-4 ) ); }
public override void ComparesAgainstExternalDataAfterReset() { var indicator = new HeikinAshi(); for (var i = 1; i <= 2; i++) { TestHelper.TestIndicator(indicator, TestFileName, "HA_Open", (ind, expected) => Assert.AreEqual(expected, (double)((HeikinAshi)ind).Open.Current.Value, 1e-3)); indicator.Reset(); TestHelper.TestIndicator(indicator, TestFileName, "HA_High", (ind, expected) => Assert.AreEqual(expected, (double)((HeikinAshi)ind).High.Current.Value, 1e-3)); indicator.Reset(); TestHelper.TestIndicator(indicator, TestFileName, "HA_Low", (ind, expected) => Assert.AreEqual(expected, (double)((HeikinAshi)ind).Low.Current.Value, 1e-3)); indicator.Reset(); TestHelper.TestIndicator(indicator, TestFileName, "HA_Close", (ind, expected) => Assert.AreEqual(expected, (double)((HeikinAshi)ind).Close.Current.Value, 1e-3)); indicator.Reset(); } }
public void ComparesAgainstExternalData() { var onBalanceVolumeIndicator = new OnBalanceVolume("OBV") { Current = { Time = new DateTime(2013, 4, 30), Value = decimal.Parse("1.156486E+08", NumberStyles.Float, CultureInfo.InvariantCulture) } }; TestHelper.TestIndicator(onBalanceVolumeIndicator, "spy_with_obv.txt", "OBV", (ind, expected) => Assert.AreEqual( expected.ToString("0.##E-00"), (onBalanceVolumeIndicator.Current.Value).ToString("0.##E-00") ) ); }
public void ComparesWithExternalDataLowerBand() { var bb = new BollingerBands(20, 2.0m, MovingAverageType.Simple); TestHelper.TestIndicator(bb, "spy_bollinger_bands.txt", "Bollinger Bands® 20 2 Bottom", (BollingerBands ind) => (double)ind.LowerBand.Current.Value); }
public void CompareAgainstExternalData() { var sma = new SimpleMovingAverage(14); TestHelper.TestIndicator(sma, "SMA14", 1e-2); // test file only has }
public void ComparesAgainstExternalDataSma() { var rsiSimple = new RelativeStrengthIndex("rsi", 14, MovingAverageType.Simple); TestHelper.TestIndicator(rsiSimple, "RSI 14"); }
public void ComparesWithExternalData() { var psar = new ParabolicStopAndReverse(); TestHelper.TestIndicator(psar, "spy_parabolic_SAR.txt", "Parabolic SAR 0.02 0.20"); }
public void ComparesAgainstExternalData() { var cci = new CommodityChannelIndex(14); TestHelper.TestIndicator(cci, "spy_with_cci.txt", "Commodity Channel Index (CCI) 14", 1e-2); }
public override void ComparesAgainstExternalData() { var atrSimple = new AverageTrueRange(14, MovingAverageType.Simple); TestHelper.TestIndicator(atrSimple, "spy_atr.txt", "Average True Range 14"); }
private void RunTestIndicator(IndicatorBase <IndicatorDataPoint> indicator, string field, decimal variance) { TestHelper.TestIndicator(indicator, TestFileName, field, (actual, expected) => { AssertResult(expected, actual.Current.Value, variance); }); }
private static void RunTestIndicator(TradeBarIndicator indicator) { TestHelper.TestIndicator(indicator, "spy_natr.txt", "NATR_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-3)); }
public void ComparesAgainstExternalData() { var mfi = new MoneyFlowIndex(20); TestHelper.TestIndicator(mfi, "spy_mfi.txt", "Money Flow Index 20"); }
private static void TestIndicator(ChandeMomentumOscillator cmo) { TestHelper.TestIndicator(cmo, "spy_cmo.txt", "CMO_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-3)); }
private static void RunTestIndicator(TradeBarIndicator indicator) { TestHelper.TestIndicator(indicator, "frama.txt", "Filt", (actual, expected) => { AssertResult(expected, actual.Current.Value); }); }
public void ComparesAgainstExternalData() { var ema = new ExponentialMovingAverage(14); TestHelper.TestIndicator(ema, "spy_with_indicators.txt", "EMA14", TestHelper.AssertDeltaDecreases(2.5e-2)); }
private static void RunTestIndicator(DoubleExponentialMovingAverage dema) { TestHelper.TestIndicator(dema, "spy_dema.txt", "DEMA_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-2)); }