Here I have modified the stdlib from MQL4 to MQL5 which was originally written byΒ MetaQuotes Software Corp.
This function is changed:
MT4
//+------------------------------------------------------------------+ //| convert integer to string contained input's hexadecimal notation | //+------------------------------------------------------------------+ string IntegerToHexString(int integer_number) Β Β { Β Β string hex_string="00000000"; Β Β intΒ Β Β Β value,shift=28; //--- Β Β for(int i=0; i<8; i++) Β Β Β Β { Β Β Β Β Β Β value=(integer_number>>shift)&0x0F; Β Β Β Β Β Β if(value<10) Β Β Β Β Β Β Β Β hex_string=StringSetChar(hex_string,i,ushort(value+'0')); Β Β Β Β Β Β else Β Β Β Β Β Β Β Β hex_string=StringSetChar(hex_string,i,ushort((value-10)+'A')); Β Β Β Β Β Β shift-=4; Β Β Β Β } //--- Β Β return(hex_string); Β Β }
MT5
//+------------------------------------------------------------------+ //| convert integer to string contained input's hexadecimal notation | //+------------------------------------------------------------------+ string IntegerToHexString(int integer_number) Β Β { Β Β string hex_string="00000000"; Β Β intΒ Β Β Β value,shift=28; //--- Β Β for(int i=0; i<8; i++) Β Β Β Β { Β Β Β Β Β Β value=(integer_number>>shift)&0x0F; Β Β Β Β Β Β if(value<10) Β Β Β Β Β Β Β Β bool check=StringSetCharacter(hex_string,i,ushort(value+'0')); Β Β Β Β Β Β else Β Β Β Β Β Β Β Β bool check=StringSetCharacter(hex_string,i,ushort((value-10)+'A')); Β Β Β Β Β Β shift-=4; Β Β Β Β } //--- Β Β return(hex_string); Β Β }