Esempio n. 1
0
        public void ComputesCorrectly()
        {
            var wilr = new WilliamsPercentR(14);

            TestHelper.TestIndicator(wilr, "spy_with_williamsR14.txt", "Williams %R 14", (ind, expected) =>
                                     ((double)ind.Current.Price).Should().BeApproximately(expected, 1e-3));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new Williams %R indicator. This will compute the percentage change of
        /// the current closing price in relation to the high and low of the past N periods.
        /// The indicator will be automatically updated on the given resolution.
        /// </summary>
        /// <param name="symbol">The symbol whose Williams %R we want</param>
        /// <param name="period">The period over which to compute the Williams %R</param>
        /// <param name="resolution">The resolution</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>The rateofchangepercent indicator for the requested symbol over the specified period</returns>
        public WilliamsPercentR WILR(string symbol, int period, Resolution?resolution = null, Func <BaseData, TradeBar> selector = null)
        {
            string name             = CreateIndicatorName(symbol, "WILR" + period, resolution);
            var    williamspercentr = new WilliamsPercentR(name, period);

            RegisterIndicator(symbol, williamspercentr, resolution, selector);
            return(williamspercentr);
        }
Esempio n. 3
0
        public void ResetsProperly()
        {
            var wilr = new WilliamsPercentR(14);

            foreach (var data in TestHelper.GetTradeBarStream("spy_with_williamsR14.txt", false))
            {
                wilr.Update(data);
            }
            Assert.True(wilr.IsReady);

            wilr.Reset();

            TestHelper.AssertIndicatorIsInDefaultState(wilr);
        }
        public void ComputesCorrectly()
        {
            var wilr = new WilliamsPercentR(14);

            TestHelper.TestIndicator(wilr, "spy_with_williamsR14.txt", "Williams %R 14", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 1e-3));
        }