Example #1
0
        /// <summary>
        /// Called when [new data].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        internal override void OnNewData(object sender, EventArgs e)
        {
            var y3 = 1.0 * Math.Sin(((2 * Math.PI) * 2.2) * _t) + _random.NextDouble() * 0.5;

            Series.Append(_t, y3);

            // Increment current time
            _t += _dt;
        }
Example #2
0
        private void LoadWickos(Symbol symbol)
        {
            Series.Clear();

            var feed = new WickoFeed(symbol, 1.0, RateToUse.BidRate);

            var wickos = new List <Wicko>();

            feed.OnWicko += (s, e) => wickos.Add(e.Wicko);

            foreach (var tick in GetTicks(symbol))
            {
                feed.HandleTick(tick);
            }

            foreach (var wicko in wickos)
            {
                Series.Append(wicko.CloseOn, wicko.OpenRate,
                              wicko.HighRate, wicko.LowRate, wicko.CloseRate,
                              new Metadata(wicko.OpenOn));
            }

            Series.InvalidateParentSurface(RangeMode.ZoomToFit);
        }
Example #3
0
        public Rule Compile(string input)
        {
            Stack <Rule> stack = new Stack <Rule>();
            Series       inner = new Series();
            Rule         roote = inner;

            Match match = Regex.Match(input, RegularExpression());

            foreach (Capture value in match.Captures)
            {
                switch (value.Value)
                {
                case "[":
                    inner = new Series();
                    Repetition repetition = new Repetition(inner);
                    stack.Push(repetition);
                    stack.Push(inner);
                    break;

                case "]":
                    if (!(stack.Pop() is Series))
                    {
                        return(null);
                    }
                    if (!(stack.Pop() is Repetition))
                    {
                        return(null);
                    }
                    break;

                case "(":
                    inner = new Series();
                    stack.Push(new Option(inner));
                    stack.Push(inner);
                    break;

                case ")":
                    if (!(stack.Pop() is Series))
                    {
                        return(null);
                    }
                    if (!(stack.Pop() is Option))
                    {
                        return(null);
                    }
                    break;

                case "|":
                    if (!(stack.Pop() is Series))
                    {
                        return(null);
                    }
                    if (!(stack.Peek() is Option option))
                    {
                        return(null);
                    }
                    inner = new Series();
                    option.Add(inner);
                    break;

                default:
                    inner.Append(new Words(value.Value));
                    break;
                }
            }

            return(roote);
        }