MT5 arithmetic bug

To add comments, please log in or register
labidus
24
labidus  

I converted my code from MT4 to MT5.

I just discovered that something was not working like it was supposed to do...

I put a lot of stuff in my magic number, when I parse the order, I validate if the magic is fitting with my current executioner.


This code was working on MT4, on MT5 it return false while it's supposed to be true!!


return m_magic_number == (magic_number & 0xffff07ff);


So my magic number in my EA is 0xff000001, the magic I compare is also 0xff000001


so "return 0xff000001 == (0xff000001 & 0xffff07ff)" is true

but it return false... on mt4 it work like a charm...

nicholi shen
2314
nicholi shen  
labidus:

I converted my code from MT4 to MT5.

I just discovered that something was not working like it was supposed to do...

I put a lot of stuff in my magic number, when I parse the order, I validate if the magic is fitting with my current executioner.


This code was working on MT4, on MT5 it return false while it's supposed to be true!!


So my magic number in my EA is 0xff000001, the magic I compare is also 0xff000001


so "return 0xff000001 == (0xff000001 & 0xffff07ff)" is true

but it return false... on mt4 it work like a charm...

I'm not sure how you are getting false... 

void OnStart() {
   Print(bool(0xff000001 == (0xff000001 & 0xffff07ff))); //true
}
labidus
24
labidus  
nicholi shen:

I'm not sure how you are getting false... 

MT4 work but MT5 always false, but the difference I was using this and the variable are int, maybe a bug between unsigned int and int



return m_magic_number == (magic_number & 0xffff07ff);


For now i am using just this:
return m_magic_number == magic_number;


... anyway I have a lot of issues with MT5, with invalid price while they are fine, it's like nothing work like what it should, I use the MT5 from my broker and it is maybe why

I have a lot of issue...


So now, kinda switch back to 4...

To add comments, please log in or register