Ejemplo n.º 1
0
        private void OnTickRecieved(String symbol, MqlTick tick)
        {
            TickRecievedEventArgs e = new TickRecievedEventArgs(symbol, tick);
            EventHandler <TickRecievedEventArgs> temp = TickRecieved;

            if (temp != null)
            {
                temp(this, e);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sends tick to all clients
 /// </summary>
 public void SendTick(String symbol, MqlTick tick)
 {
     lock (lockClients)
         for (int i = 0; i < _Clients.Count; i++)
         {
             try
             {
                 _Clients[i].SendTick(symbol, tick);
             }
             catch (CommunicationException)
             {
                 // it seems that connection with client has lost - let's delete him
                 _Clients.RemoveAt(i);
                 i--;
             }
         }
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            ExportService host = new ExportService("mt5");

            host.Open();

            Console.WriteLine("Press any key to start tick export");
            Console.ReadKey();

            int total = 0;

            Stopwatch sw = new Stopwatch();

            for (int c = 0; c < 10; c++)
            {
                int counter = 0;
                sw.Reset();
                sw.Start();

                while (sw.ElapsedMilliseconds < 1000)
                {
                    for (int i = 0; i < 100; i++)
                    {
                        MqlTick tick = new MqlTick {
                            Time = 640000, Bid = 1.2345
                        };
                        host.SendTick("GBPUSD", tick);
                    }
                    counter++;
                }

                sw.Stop();
                total += counter * 100;

                Console.WriteLine("{0} ticks per second", counter * 100);
            }

            Console.WriteLine("Average {0:F2} ticks per second", total / 10);

            host.Close();

            Console.ReadKey();
        }
Ejemplo n.º 4
0
        public static int AddTick(ref MqlTick tick, ref double bidsum)
        {
            bidsum = 0.0;

            if (list == null)
            {
                list = new List <MqlTick>();
            }

            tick.Volume = 666;
            list.Add(tick);

            foreach (MqlTick t in list)
            {
                bidsum += t.Ask;
            }

            return(list.Count);
        }
Ejemplo n.º 5
0
 private void OnTickRecieved(String symbol, MqlTick tick)
 {
     TickRecievedEventArgs e = new TickRecievedEventArgs(symbol, tick);
     EventHandler<TickRecievedEventArgs> temp = TickRecieved;
     if (temp != null) temp(this, e);
 }
Ejemplo n.º 6
0
 public void SendTick(string symbol, MqlTick tick)
 {
     OnTickRecieved(symbol, tick);
 }
Ejemplo n.º 7
0
 public TickRecievedEventArgs(String symbol, MqlTick tick)
 {
     Symbol = symbol;
     Tick   = tick;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Sends tick to all clients
 /// </summary>
 public void SendTick(String symbol, MqlTick tick)
 {
     lock (lockClients)
         for (int i = 0; i < _Clients.Count; i++)
             try
             {
                 _Clients[i].SendTick(symbol, tick);
             }
             catch (CommunicationException)
             {
                 // it seems that connection with client has lost - let's delete him
                 _Clients.RemoveAt(i);
                 i--;
             }
 }
Ejemplo n.º 9
0
 public void SendTick(string symbol, MqlTick tick)
 {
     OnTickRecieved(symbol, tick);
 }
Ejemplo n.º 10
0
 public TickRecievedEventArgs(String symbol, MqlTick tick)
 {
     Symbol = symbol;
     Tick = tick;
 }