Exemple #1
0
        public virtual void OnStartTicks(object state)
        {
            counter++;
            if (counter > 1)
            {
                date = date.AddMinutes(6);
            }
            if (counter % 102 == 0)
            {
                date = new DateTime(2021, 04, dayCounter, 07, 00, 00);
                dayCounter++;
                counter = 0;
            }
            TimerEventArgs args = new TimerEventArgs();

            args.Ticker = counter;
            args.Time   = date;
            if (date.Day == totalDays.Day)
            {
                Timer_.Change(Timeout.Infinite, Timeout.Infinite);
            }
            else
            {
                SendTick?.Invoke(this, args);
            }
        }
Exemple #2
0
    public void LoadSong(ISong newSong)
    {
        // gather new tempo
        bpm        = newSong.bpm;
        perbeat    = newSong.perbeat;
        perbar     = newSong.perbar;
        permeasure = newSong.permeasure;
        CalculateTempo();

        // set up callbacks
        Tick       += newSong.Tick;
        MeasureEnd += newSong.MeasureEnd;
    }
Exemple #3
0
        private void OnReceiveRealData(object sender, _DKHOpenAPIEvents_OnReceiveRealDataEvent e)
        {
            sb = new StringBuilder(512);

            foreach (int fid in Array.Find(catalog, o => o.ToString().Contains(e.sRealType)))
            {
                sb.Append(axAPI.GetCommRealData(e.sRealKey, fid)).Append(',');
            }

            if (e.sRealType.Equals(sRealType[0]))
            {
                SendTick?.Invoke(this, new TickEvent(sb));
                SendDay?.Invoke(this, new DayEvent(sb));

                return;
            }
            if (e.sRealType.Equals(sRealType[1]) && int.Parse(sb.ToString().Substring(0, 6)) > 153459)
            {
                string[] fg = sb.ToString().Split(',');

                if (fg[52].Contains("-"))
                {
                    fg[52] = fg[52].Substring(1);
                }

                double price = double.Parse(fg[52]);

                SendTick?.Invoke(this, new TickEvent(false, fg[0], price, 0));
                SendDay?.Invoke(this, new DayEvent(false, price));

                return;
            }
            if (e.sRealType.Equals(sRealType[2]))
            {
                string[] tg = sb.ToString().Split(',');

                if (tg[0].Equals("e") && Deadline == false)
                {
                    Deadline = true;

                    Request();

                    SendExit?.Invoke(this, new ForceQuit(0));
                }
                return;
            }
            sb = null;
        }
Exemple #4
0
        private int Analysis(double price)
        {
            int sc = shortTick.Count, lc = longTick.Count;

            shortTick.Add(sc > 0 ? ema.Make(st.ShortTickPeriod, sc, price, shortTick[sc - 1]) : ema.Make(price));
            longTick.Add(lc > 0 ? ema.Make(st.LongTickPeriod, lc, price, longTick[lc - 1]) : ema.Make(price));

            if (sc < 2 || lc < 2)
            {
                return(0);
            }

            double slGap = shortTick[sc] - longTick[lc];

            SendTick?.Invoke(this, new TickWidthGap(price, slGap, price - shortTick[sc]));

            return(slGap - (shortTick[sc - 1] - longTick[lc - 1]) > 0 ? 1 : -1);
        }
Exemple #5
0
        public void StartProgress(int param)
        {
            ie = new EnumerateDay();

            foreach (string val in ie)
            {
                string[] arr = val.Split(',');

                if (arr[1].Contains("-"))
                {
                    arr[1] = arr[1].Substring(1);
                }

                double price = double.Parse(arr[1]);

                s = new MakeDay(arr[0].Substring(6, 2));

                SendDay?.Invoke(this, new DayEvent(s.Check, price));
            }
            ie  = new EnumerateTick();
            act = new Action(() => Log(param));

            foreach (string val in ie)
            {
                string[] arr = val.Split(',');

                s = new TimeCheck();

                if (arr[1].Contains("-"))
                {
                    arr[1] = arr[1].Substring(1);
                }

                double price = double.Parse(arr[1]);

                SendTick?.Invoke(this, new TickEvent(s.Make(arr[0].Substring(9, 1)), arr[0], price, int.Parse(arr[2]), param));

                s = new MakeDay(arr[0].Substring(4, 2));

                SendDay?.Invoke(this, new DayEvent(s.Check, price));
            }
            act.BeginInvoke(act.EndInvoke, null);
        }