binary data assignment

samjesse

Active Trader
Aug 30, 2011
118
0
27
Hi again

I am not sure how to get MT5 to do this.

MQL5:
            string s1="0110001";
            string s2="0010101";
            string s3=s1^s2;

I expecting 0100100
many thx
 
Last edited by a moderator:

Enivid

Administrator
Staff member
Nov 30, 2008
18,535
1,355
144
Odesa
www.earnforex.com
First, 0110001^0010101 = 0010001, not 0100100.
Second, you can't use strings for that. Have to use integers and only decimal or hex form. For example:
MQL5:
int a = 49;
int b = 21;
int c = a ^ b; // Should return 17.
or:
MQL5:
int a = 0x31;
int b = 0x15;
int c = a ^ b; // Should return 0x11.
 
Last edited: