Search code examples
asp.net-web-apimetatrader4

how to get ask and bid from .Net ClrWrapper


I am using MetaTrader4.Manager.Wrapper

I want to get all currency (Symbol in MT4) and their bid & ask from MT4. I tried using :

public IList<Symbol> Get()
    {
        using (var metatrader = new ClrWrapper(new ConnectionParameters
        {
            Login = serverdata.Login,
            Password = serverdata.Password,
            Server = serverdata.Server
        }, serverdata.path))
        {
            var Refresh = metatrader.SymbolsRefresh();

            IList<Symbol> Live = metatrader.SymbolsGetAll();
            return Live;

        }
    }

From the code i got the Name : AUDCAD, AUDCHF, EURCHF, etc, but BidTickValue and AskTickValue return 0.0.

I tried using this answer but the Symbol return null and Bid return 0.

Is there another way to get the Name and Bid and Ask value? And what is Pumping Mode means? Thank you before


Solution

  • Pumping is MT4 mode, when you subscribe to different events and MT4 server sends you updates, without requesting it manually.

    For example: quotes, trades, users.

    SymbolsGetAll will return you quotes only when you in pumping mode, and it will return latest received quote.

    If you are not going to use pumping mode, you can get latest quote user ChartRequest method, but it will be much slower.