Just want to get 1 tick

Apr 10, 2013 at 5:19 PM
You gotta start somewhere right? I like to think I know my way around c# but I guess not. I wanted to create a simple app first to get a tick and then go from there. Anyways I followed the instructions and I just get a "Net Bridge Error: Server closed connection." error in mt4 and no ticks in the app. Either I am missing a step or I am just going crazy. Here is what I have.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TradePlatform.MT4.Core;

namespace mt4TestWithGui
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            Bridge.InitializeHots(true);
            MetaTrader4 mt4 = Bridge.GetTerminal(635224, "EURJPY");             
            mt4.QuoteRecieved += mt4_QuoteRecieved;
        }
        int cnt;
        private void mt4_QuoteRecieved(MqlHandler obj)
        {
            cnt++;
            label1.Text = cnt.ToString();            
        }
        
    }
}
Here is my app.config file that I just copied the code from the Shell.exe's app.config but it seems ok per the documentation
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="BridgeConfiguration" type="TradePlatform.MT4.Core.Config.BridgeConfiguration, TradePlatform.MT4.Core"/>
  </configSections>
  <runtime>
    <loadFromRemoteSources enabled="true" />
  </runtime>
  <appSettings>
    <add key="NotifyToEmail" value="[YOUR_EMAIL]"/>
  </appSettings>
  <BridgeConfiguration useEventLog="true" wcfBaseAddress="http://localhost:8080/TradePlatform">
    <Hosts>
      <Host name="host1" ipAddress="127.0.0.1" port="2007">
        <Handlers>
          <!-- Experts -->
          <Handler name="MACrossExpert" typeName="TradePlatform.MT4.SDK.Library.Experts.MACrossExpert" assemblyName="TradePlatform.MT4.SDK.Library" />
          <!-- Indicators -->
          <Handler name="PrevDayHighLowIndicator" typeName="TradePlatform.MT4.SDK.Library.Indicators.PrevDayHighLowIndicator" assemblyName="TradePlatform.MT4.SDK.Library" />
          <!-- Scripts -->
          <Handler name="ImportOrdersScript" typeName="TradePlatform.MT4.SDK.Library.Scripts.ImportOrdersScript" assemblyName="TradePlatform.MT4.SDK.Library" />
          <Handler name="SendEmailScript" typeName="TradePlatform.MT4.SDK.Library.Scripts.SendEmailScript" assemblyName="TradePlatform.MT4.SDK.Library" />
          <Handler name="UnitTestScript" typeName="TradePlatform.MT4.SDK.Library.Scripts.UnitTestScript" assemblyName="TradePlatform.MT4.SDK.Library" />
          <Handler name="QuietListener" typeName="TradePlatform.MT4.SDK.Library.Handlers" assemblyName="TradePlatform.MT4.SDK.Library" />
          <Handler name="SmokeTestScript" typeName="TradePlatform.MT4.SDK.Library.Scripts.SmokeTestScript" assemblyName="TradePlatform.MT4.SDK.Library">
            <Parameters>
              <Parameter propertyName="TestProperty" propertyValue="25" />
            </Parameters>
          </Handler>
          <!-- Common -->
          <Handler name="TickCounter" typeName="TradePlatform.MT4.SDK.Library.Common.TickCounter" assemblyName="TradePlatform.MT4.SDK.Library" />
          <Handler name="QuoteListener" typeName="TradePlatform.MT4.Core.Handlers.QuoteListener" assemblyName="TradePlatform.MT4.Core" />
        </Handlers>
      </Host>
      <Host name="host2" ipAddress="127.0.0.1" port="2008">
        <Handlers>
        </Handlers>
      </Host>
    </Hosts>
  </BridgeConfiguration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="[FROM_ADDRESS]">
        <network host="smtp.gmail.com" userName="[GMAIL_LOGIN]" password="[GMAIL_PASS]" port="587" enableSsl="true"/>
      </smtp>
    </mailSettings>
  </system.net>
  <connectionStrings>
    <add name="TradePlatformEntities" connectionString="metadata=res://*/TradePlatformModel.csdl|res://*/TradePlatformModel.ssdl|res://*/TradePlatformModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\v11.0;attachdbfilename=[PATH_TO_MDF_FILE];integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient"/>
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <remove name="Default" />
        <add name="consoleListener" type="TradePlatform.MT4.Core.Utils.ConsoleBridgeTraceListener, TradePlatform.MT4.Core" />
      </listeners>
    </trace>
  </system.diagnostics>
  <system.serviceModel>
    <services>
      <service name="TradePlatform.MT4.Data.TradePlatformDataService">
        <endpoint address="http://localhost:9000/TradePlatform/svc" binding="webHttpBinding" contract="System.Data.Services.IRequestHandler" />
      </service>
    </services>
  </system.serviceModel>
</configuration>
Apr 15, 2013 at 11:10 AM
I got my tick and to be honest I am not sure exactly what the problem was but I can tell you this. It was because the most up to date was not the packaged download code. You have to download the source and use the dlls from there. Also there was a problem with my app config which I fixed by just copying the app.config from the source. Once again I am not sure what the problem with the app.config was but if you are having the same problem then you can just get the dlls and the app.config from there.

gl to all