Download MetaTrader 5

StrToInteger

To add comments, please log in or register
parham.trader
281
parham.trader  

Hi friends,

 When I want to use StrToInteger or StringToInteger functions it results to -1 .

does anyone know about the problem ? how can I fix this issue ?

thank you all 

whroeder1
15015
whroeder1  
parham.trader:

When I want to use StrToInteger or StringToInteger functions it results to -1 .

does anyone know about the problem ? how can I fix this issue ?

  1. No it doesn't
     void OnStart()
      {
      string s = "-123";
      int    i = StrToInteger(s);
      PrintFormat("s='%s' i=%i", s,i);
    // 2015.10.09 10:09:22.101    testscr AUDUSD,H4: s='123' i=123
    // 2015.10.09 10:10:06.869    testscr AUDUSD,H4: s='-123' i=-123
    }
    
  2. Print your variables and show us your code and output.
parham.trader
281
parham.trader  

thank you ,

it is solved, I found out that the size of my number was bigger than what is permitted for an int type.(even for long or ulong ones)

To add comments, please log in or register