Binary.com Bot with Metatrader 5 Bridge

Hello

Here i'm sharing my success with you , with 15 days of coding finally i coded c# bot with Metatrader 5 Support

Comments

  • Congratulations for the same friend

    May you please help me with following issue

  • i am getting following message in WebSoket Exception :

    "The Buffer type '96' is invalid. Valid Buffer types are : 'Close', 'BinaryFragment', 'BinaryMessage', 'UTF8Fragment', 'UTF8Message' "

    Thanks in Advance
    Ajay

  • i am using the Sample Code Provided by binary.com at https://developers.binary.com/demos/

    using C# API

  • Which language you using to code bot ?
    Post the full codes to check

  • i am using the sample code given by Binary.com at https://developers.binary.com/demos/

    Here you go :

    class BinaryWS
        {
            private ClientWebSocket ws = new ClientWebSocket();
            private Uri uri = new Uri("wss://ws.binaryws.com/websockets/v3?app_id=" + appID);
    
            public async Task SendRequest(string data)
            {
    
                while(this.ws.State == WebSocketState.Connecting){};
                if (this.ws.State != WebSocketState.Open)
                {
                    throw new Exception("Connection is not open.");
                }
    
                var reqAsBytes = Encoding.UTF8.GetBytes(data);
                var ticksRequest = new ArraySegment<byte>(reqAsBytes);
    
                await this.ws.SendAsync(ticksRequest,
                    WebSocketMessageType.Text,
                    true,
                    CancellationToken.None);
    
                Console.WriteLine("The request has been sent: ");
                Console.WriteLine(data);
                Console.WriteLine("\r\n \r\n");
    
    
            }
    
            public async Task StartListen(){
                WebSocketReceiveResult result;
                while (this.ws.State == WebSocketState.Open){
                var buffer = new ArraySegment<byte>(new byte[1024]);
                        do
                        {
                            result = await this.ws.ReceiveAsync(new ArraySegment<byte>(buffer.Array), CancellationToken.None);
    
                            if (result.MessageType == WebSocketMessageType.Close)
                            {
                                Console.WriteLine("Connection Closed!");
                                break;
                            }
                            else
                            {
                                var str = Encoding.UTF8.GetString(buffer.Array, 0, result.Count);
                                Console.WriteLine("Received Data at: " + DateTime.Now);
                                Console.WriteLine(str);
                                Console.WriteLine("\r\n");
                            }
    
                        } while (!result.EndOfMessage);
                }
            }
    
            public async Task Connect(){
                Console.WriteLine("Prepare to connect to: " + this.uri.ToString());
                Console.WriteLine("\r\n");
    
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
                await ws.ConnectAsync(uri, CancellationToken.None);
    
                Console.WriteLine("The connection is established!");
                Console.WriteLine("\r\n");
            }
    
            static void Main(string[] args)
            {
                var bws = new BinaryWS();
                bws.Connect().Wait();
    
                bws.SendRequest("{\"authorize\": \"" + APIToken +"\"}").Wait();
                bws.StartListen();
    
                Console.ReadLine();
            }
        }
    
  • You can use bridge framework. Www.binarysmartbridge.com
  • Hi Guys, if anyone is interested in a Binary.com Bridge for MT4 please contact me at:
    [email protected]
    or @ skype:
    bernocchialfa

    The bridge can:

    • Automate you EA for immediately placing trades at Binary.com
    • Listen to Alerts of the EAs you do not have the source code and immediately decode them and place the trade in Binary.com
    • Work as a copier: you take a trade in any BO broker in MT4 and the bridge does the same in Binary.com

    Alessandro.

Sign In or Register to comment.