Esempio n. 1
0
        public async Task TestObvAsync()
        {
            var equity = await ImportEquityAsync();

            var indicator = new OnBalanceVolume(equity);
            var result0   = indicator.ComputeByIndex(equity.Count - 1);
            var result1   = indicator.ComputeByIndex(equity.Count - 2);
            var result2   = indicator.ComputeByIndex(equity.Count - 3);

            Assert.IsTrue(result0.Obv - result1.Obv > 0 && result1.Obv - result2.Obv < 0);
        }
Esempio n. 2
0
        protected override PatternResult <Trend?> ComputeByIndexImpl(int index)
        {
            if (index < 1)
            {
                return(new PatternResult <Trend?>(Equity[index].DateTime, null));
            }

            var latest       = _obvIndicator.ComputeByIndex(index);
            var secondLatest = _obvIndicator.ComputeByIndex(index - 1);

            return(new PatternResult <Trend?>(Equity[index].DateTime, Decision.IsTrending(latest.Obv - secondLatest.Obv)));
        }