Note, all those integers need to be of type double.
You need to convert the variables to strings, and as decimal places can vary, do a search for any 'padded' zeros added by DoubleToStr.
string strvar = DoubleToStr(var,8);
int ndx = StringFind(strvar,"0",0);
if (ndx == -1)
ndx = StringLen(strvar);
Print(StringSubStr(strvar,ndx - 2, 2));At least that's how I'd do it. If anyone knows another way, let me know!
Thanks you for your help
But I've got a message :
'StringSubStr' function is not defined
How can I do ?
Best regardsit just a small typing mistake StringSubstr instead of StringSubStr
and just a small thing to take care: in omelette's code the maximum size that is assumed for your number is 8 digits but it may be more.
Hi
Thank you very much for your help!!
it just a small typing mistake StringSubstr instead of StringSubStr and just a small thing to take care: in omelette's code the maximum size that is assumed for your number is 8 digits but it may be more.
Hi. Don't think it can be - MT limits the number of decimal places to 8 as far I I'm aware. Switch to a different platform, then yes.
Natsirte, while I'm here I should point out (in case you didn't realize it) that the code I posted expects the integer part of 'var' to be non-zero. If this is a possibility, an additional check would be required.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use