I checked out the MQL docs a bit and came up with this:
string Pad(int number, int requiredLength)
{
string strNumber = number;
string strNewNumber = "";
int intDiff = StringLen(strNumber) - requiredLength;
if (intDiff > 0)
{
for (intCurChar = 0; intCurChar < intDiff; intCurChar++)
{
strNewNumber += "0";
}
strNewNumber += strNumber;
}
return strNewNumber;
}
Please note that I didn't test this and this is the first piece of MQL I ever wrote, but it should give you an idea of how to do this. Is this what you had in mind?
Ruben.