How can I get information from MT4 to a C# application?

Feb 15, 2013 at 5:44 PM
Edited Feb 16, 2013 at 2:21 PM
Hello!
I have a problem in the use of the API.
I'm not an expert of C#.
I want to get the prices of MT4 and put they in my C# application.
But my code does not work.
public class Wire : MqlHandler
{
    protected static MetaTrader4 meta;

    public static void Main()
    {
        Bridge.InitializeHots(true);
        meta = Bridge.GetTerminal(8489395, "EURUSD");
        meta.QuoteRecieved += NewQuote;
    }

    private static void NewQuote(MqlHandler mql)
    {
        double bid = mql.Bid();
        double ask = mql.Ask();

        Console.WriteLine("Bid: {0};",bid.ToString());
        Console.WriteLine("Ask: {0};", ask.ToString());
    }
}
Why this code does not work?
The debug tells me that the error is in the "InitializeHots()" method (NullReferenceException).
And also says me that "mql.Bid()" has null value.

Have you a solution or another code that works?
Thanks in advance. :-)

P.S.
Sorry for my bad english, but I'm italian.
Mar 5, 2013 at 8:11 AM
you have attach all file in rar. attach it to chart. and copy all config in shell.config to your app config. run mt4 and run you app.
Apr 25, 2013 at 9:29 AM
Hi Cadddami,
Do you successfully run your app?
Cox I am also a newbie to tradeplatform. Can you share your experience to let it work?
best wishes,
Ken