public void ulcerIndexUsingTimeFrame14UsingIBMData() { UlcerIndexIndicator ulcer = new UlcerIndexIndicator(new ClosePriceIndicator(ibmData), 14); Assert.AreEqual(ulcer.GetValue(0), 0); // From: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ulcer_index Assert.AreEqual(ulcer.GetValue(26), 1.3047326664928352567595893019M); Assert.AreEqual(ulcer.GetValue(27), 1.3022442772854439559911234689M); Assert.AreEqual(ulcer.GetValue(28), 1.2156227590957400106436266852M); Assert.AreEqual(ulcer.GetValue(29), 0.9967305155530988753000776083M); Assert.AreEqual(ulcer.GetValue(30), 0.7257169838104788684671694592M); Assert.AreEqual(ulcer.GetValue(31), 0.4530380971758671142314514174M); Assert.AreEqual(ulcer.GetValue(32), 0.4284100872255782787980421088M); Assert.AreEqual(ulcer.GetValue(33), 0.4284100872255782787980421088M); Assert.AreEqual(ulcer.GetValue(34), 0.4284100872255782787980421088M); Assert.AreEqual(ulcer.GetValue(35), 0.4287349119903383338327059684M); Assert.AreEqual(ulcer.GetValue(36), 0.5089063000184522707318409976M); Assert.AreEqual(ulcer.GetValue(37), 0.6672646295927154897520641717M); Assert.AreEqual(ulcer.GetValue(38), 0.9913518177402269613359840276M); Assert.AreEqual(ulcer.GetValue(39), 1.0921325741850082888500073224M); Assert.AreEqual(ulcer.GetValue(40), 1.3161456073667125991227406808M); Assert.AreEqual(ulcer.GetValue(41), 1.5631807417469005351409171744M); Assert.AreEqual(ulcer.GetValue(42), 1.7608952153624351692835645306M); }
public void UlcerIndexUsingTimeFrame14UsingIbmData() { var ulcer = new UlcerIndexIndicator(new ClosePriceIndicator(_ibmData), 14); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(0), 0); // From: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ulcer_index TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(26), 1.3047); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(27), 1.3022); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(28), 1.2156); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(29), 0.9967); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(30), 0.7257); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(31), 0.453); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(32), 0.4284); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(33), 0.4284); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(34), 0.4284); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(35), 0.4287); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(36), 0.5089); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(37), 0.6673); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(38), 0.9914); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(39), 1.0921); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(40), 1.3161); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(41), 1.5632); TaTestsUtils.AssertDecimalEquals(ulcer.GetValue(42), 1.7609); }