Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1327

 
Followed the MT4 example "STRINGS: ASCII CHARACTERS TABLE AND USE"

//+------------------------------------------------------------------+
//| StringLowerCase |
//+------------------------------------------------------------------+
string StringLowerCase(string str)
  {
   string s = str;
   int lenght = StringLen(str) - 1, symbol;
   while(lenght >= 0)
     {
      symbol = StringGetChar(s, lenght);
      if((symbol > 64 && symbol < 91) || (symbol > 191 && symbol < 224))
         s = StringSetChar(s, lenght, symbol + 32);// тут possible loss of data due to type conversion
      else
         if(symbol > -65 && symbol < -32)
            s = StringSetChar(s, lenght, symbol + 288);// тут possible loss of data due to type conversion
      lenght--;
     }
   return(s);
  }
//+------------------------------------------------------------------+
//| StringUpperCase |
//+------------------------------------------------------------------+
string StringUpperCase(string str)
  {
   string s = str;
   int lenght = StringLen(str) - 1, symbol;
   while(lenght >= 0)
     {
      symbol = StringGetChar(s, lenght);
      if((symbol > 96 && symbol < 123) || (symbol > 223 && symbol < 256))
         s = StringSetChar(s, lenght, symbol - 32);// тут possible loss of data due to type conversion
      else
         if(symbol > -33 && symbol < 0)
            s = StringSetChar(s, lenght, symbol + 224);// тут possible loss of data due to type conversion
      lenght--;
     }
   return(s);
  }

If you don't mind, please help me fix it...
 
Artyom Trishkin:

The cycle must be reversed. Otherwise there will be questions about why it is not working properly

I don't know what that means.
 
MakarFX:
I don't understand what this means???

When deleting, the numbering is shifted if from lesser to greater indexing, and when reverse looping, the last element is deleted.

When index numbering is shifted, deletion errors may occur. The index of the 3rd element will become the second element, and the second element is already deleted.

 
Valeriy Yastremskiy:

When deleting, the numbering is shifted if from lesser to greater indexing, and when reverse looping, the last element is deleted.

When index numbering is shifted, deletion errors may occur. The index of the 3rd element will become the second and the second element is already deleted.

Should I do this?

for(int a = ObjectsTotal()-1; a>=0; a--)

 
MakarFX:

Do I have to do this?


Yes.

 
Valeriy Yastremskiy:

Yes.

Thank you
 
Alekseu Fedotov:

Do that:

And check the help more often.

Alexey, thank you very much for your help - I've started my grail machine))))))))))))))))) but I think I'll be back here more than once for advice

 
Nataliia Darsavelidze:
Hi! In the chart settings there is an option "show trading history". How is it implemented in the code? I cannot remove it programmatically. How do you do?

The question is open.

 
Nataliia Darsavelidze:

The question is open.

The question seems to be about MT5. The answer is: Not programmatically. The question can be closed.

 
Nataliia Darsavelidze:

The question is open.

I haven't heard about the option, I haven't seen it.

But it is possible to make a programme (script, expert, indicator)

Reason: