1
votes

How to use MT4 ManageAPI to create an account and change password? Can you show me a demo?

Thank you very much!

1

1 Answers

1
votes

UserRecordNew method should be used to create new user and UserPasswordSet to update password:

   using (var mt = new ClrWrapper (new ConnectionParameters { Login = 123456, Password = "managerPassword", Server = "serverIp:serverPort" }))
   {
       var user = new UserRecord
       {
           Group = "demoforex",
           Leverage = 100,
           Name = "Test account",
           Password = "qwe123",
           PasswordInvestor = "qwe123"
       };

       var result = mt.UserRecordNew(user);
       var passwordChangeResult = mt.UserPasswordSet(user.Login, "newPass123", 0/*0 - to change trader's password, 1 - investor*/, 0/*0 - not to clean public key, 1 - to clean public key*/)
   }

result equals 0 means that user was successfully created. Newly create user login will be usigned to user.Login property.

All parameters in above example are mandatory. Passwords must be between 6 and 15 character and must contain at least contain at least one lowercase letter and one number