예제 #1
0
        public static UpDown Series(Bars bars)
        {
            string description = string.Concat(new object[] { "UpDown()" });

            if (bars.Cache.ContainsKey(description))
            {
                return((UpDown)bars.Cache[description]);
            }

            UpDown _UpDown = new UpDown(bars, description);

            bars.Cache[description] = _UpDown;
            return(_UpDown);
        }
예제 #2
0
        public StoneTrend(Bars bars, int period, string description)
            : base(bars, description)
        {
            if (bars.Count < period)
            {
                return;
            }

            DataSeries updown_s = UpDown.Series(bars);

            base.FirstValidValue = period;

            for (int i = FirstValidValue; i < bars.Count; i++)
            {
                base[i] = (@updown_s[i] - @updown_s[i - period]) * 100.0 / period;
            }
        }