Пример #1
0
 public Mt5Expert(int handle, string symbol, double bid, double ask, IMetaTraderHandler mtHandler, bool isTestMode) :
     base(handle, symbol, bid, ask, mtHandler)
 {
     IsTestMode          = isTestMode;
     _stopTimer.Interval = StopExpertInterval;
     _stopTimer.Elapsed += _stopTimer_Elapsed;
 }
Пример #2
0
        public void InitExpert(int expertHandle, int port, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
        {
            Debug.WriteLine("MtApiServerInstance::InitExpert: symbol = {0}, expertHandle = {1}, port = {2}", symbol, expertHandle, port);

            MtServer server = null;
            lock (mServersDictionary)
            {
                if (mServersDictionary.ContainsKey(port))
                {
                    server = mServersDictionary[port];
                }
                else
                {
                    server = new MtServer(port);
                    server.Stopped += new EventHandler(server_Stopped);
                    mServersDictionary[port] = server;

                    server.Start();
                }
            }

            var expert = new MtExpert(expertHandle, new MtQuote(symbol, bid, ask), mtHandler);

            lock (mExpertsDictionary)
            {
                mExpertsDictionary[expert.Handle] = expert;
            }

            server.AddExpert(expert);
        }
Пример #3
0
        public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
        {
            if (mtHandler == null)
            {
                throw new ArgumentNullException(nameof(mtHandler));
            }

            Quote     = quote;
            Handle    = handle;
            _mtHadler = mtHandler;
        }
Пример #4
0
        public MtExpert(int handle, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
        {
            if (mtHandler == null)
            {
                throw new ArgumentNullException(nameof(mtHandler));
            }

            _quote = new MtQuote {
                ExpertHandle = handle, Instrument = symbol, Bid = bid, Ask = ask
            };
            Handle    = handle;
            _mtHadler = mtHandler;
        }
Пример #5
0
        public void InitExpert(int expertHandle, int port, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
        {
            if (mtHandler == null)
            {
                throw new ArgumentNullException(nameof(mtHandler));
            }

            Log.InfoFormat("InitExpert: begin. symbol = {0}, expertHandle = {1}, port = {2}", symbol, expertHandle, port);

            MtServer server;

            lock (_servers)
            {
                if (_servers.ContainsKey(port))
                {
                    server = _servers[port];
                }
                else
                {
                    server          = new MtServer(port);
                    server.Stopped += server_Stopped;
                    _servers[port]  = server;

                    server.Start();
                }
            }

            var expert = new MtExpert(expertHandle, new MtQuote {
                Instrument = symbol, Bid = bid, Ask = ask, ExpertHandle = expertHandle
            }, mtHandler);

            lock (_experts)
            {
                _experts[expert.Handle] = expert;
            }

            server.AddExpert(expert);

            Log.Info("InitExpert: end");
        }
Пример #6
0
        public void InitExpert(int expertHandle, int port, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
        {
            Debug.WriteLine("MtApiServerInstance::InitExpert: symbol = {0}, expertHandle = {1}, port = {2}", symbol, expertHandle, port);

            MtServer server = null;

            lock (mServersDictionary)
            {
                if (mServersDictionary.ContainsKey(port))
                {
                    server = mServersDictionary[port];
                }
                else
                {
                    server                   = new MtServer(port);
                    server.Stopped          += new EventHandler(server_Stopped);
                    mServersDictionary[port] = server;

                    server.Start();
                }
            }

            var expert = new MtExpert(expertHandle, new MtQuote(symbol, bid, ask), mtHandler);

            lock (mExpertsDictionary)
            {
                mExpertsDictionary[expert.Handle] = expert;
            }

            server.AddExpert(expert);
        }
Пример #7
0
 public Mt5Expert(int handle, string symbol, double bid, double ask, IMetaTraderHandler mtHandler, bool isTestMode) :
     base(handle, symbol, bid, ask, mtHandler)
 {
     IsTestMode = isTestMode;
 }
Пример #8
0
 public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
 {
     Quote     = quote;
     Handle    = handle;
     _mtHadler = mtHandler;
 }
Пример #9
0
 public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
 {
     Quote = quote;
     Handle = handle;
     mMtHadler = mtHandler;
 }