//subscribe some object to receive New Deals public void SubscribeDealSink(ref clsDealSink myDealSink) { if (!CheckIfMannagerWorks()) { return; } var resDealSink = myDealSink.RegisterSink(); var requestResult1 = m_manager.DealSubscribe(myDealSink); }
//connect to server and start monitoring new deals public void StartWatch() { using (clsMT5 mt5 = new clsMT5()) { mt5.Initialize(); var log_result = mt5.m_manager.Connect(this.Connection.Server, this.Connection.uLogin, this.Connection.Password, "", MetaQuotes.MT5ManagerAPI.CIMTManagerAPI.EnPumpModes.PUMP_MODE_FULL, 10000); if (log_result != MTRetCode.MT_RET_OK) { return; } clsDealSink myDealSink = new clsDealSink(); myDealSink.set_report_function(this.TellOutside); mt5.SubscribeDealSink(ref myDealSink); while (this.RunMe) { Thread.Sleep(1000); } Console.WriteLine("Quting watching"); } }