shortname = "T1F Price v6 (" + bas + ")";

 

Hello freinds,

 

I'm tranfering an indicator from MQL4 to MQL5, and I have this line:

 shortname = "T1F Price v6 (" + bas + ")";

 

as -   bas      - is an integer.

 

I got a massage:  shortname = implicit conversion from 'number' to 'string' 

How do I overcome this?

 

Thanks 

 
crossy:

Hello freinds,

 

I'm tranfering an indicator from MQL4 to MQL5, and I have this line:

 shortname = "T1F Price v6 (" + bas + ")";

 

as -   bas      - is an integer.

 

I got a massage:  shortname = implicit conversion from 'number' to 'string' 

How do I overcome this?

 

Thanks 

 

Try this.

shortname = "T1F Price v6 (" + IntegerToString(bas) + ")";


 
wackena:

Try this

Thank you wackena,

It works great.

 

I need another help.

At MQL4 I have:  

i_digits=MarketInfo (Symbol(),MODE_DIGITS);

and I changed it to:  

SymbolInfoInteger(c_symbol,SYMBOL_DIGITS);

But I got the masage:

possible loss of data due to type conversion.

Can you help?

Thank you.
 

Documentation on MQL5: Language Basics / Data Types / Typecasting
  • www.mql5.com
Language Basics / Data Types / Typecasting - Documentation on MQL5
 
crossy:

Thank you wackena,

It works great.

 

I need another help.

At MQL4 I have:  

i_digits=MarketInfo (Symbol(),MODE_DIGITS);

and I changed it to:  

SymbolInfoInteger(c_symbol,SYMBOL_DIGITS);

But I got the masage:

possible loss of data due to type conversion.

Can you help?

Thank you.
 

 

Try applying this typecasting. https://www.mql5.com/en/docs/basis/types/casting

int i_digits=0;

i_digits=(int)SymbolInfoInteger(c_symbol,SYMBOL_DIGITS);
Documentation on MQL5: Language Basics / Data Types / Typecasting
  • www.mql5.com
Language Basics / Data Types / Typecasting - Documentation on MQL5
 
wackena:

Try applying this typecasting. https://www.mql5.com/en/docs/basis/types/casting

 

Yes, It works.

Can you please see the following masages. If you can I will appriciate your kindness and your pasiont:

1) int cur_time=TimeLocal();  says:  possible loss of data due to type conversion

2)  double weight_calc=0;   THEN
         for(int j = 0; j < length; j++)
         {
            weight_calc = weight_calc + GetTickValue (SYMB,i);

         }

THEN

      for (int j=0;j<length;j++)
      {
         double weight=GetTickValue (Pair[j],shift)/weight_calc;

It says: 'weight_calc' - undeclared identifier. But It was declared?

 

I have more, but I ashamed to disturbe you, too much.

Thanks.
  

 
crossy:

Yes, It works.

Can you please see the following masages. If you can I will appriciate your kindness and your pasiont:

1) int cur_time=TimeLocal();  says:  possible loss of data due to type conversion

2)  double weight_calc=0;   THEN
         for(int j = 0; j < length; j++)
         {
            weight_calc = weight_calc + GetTickValue (SYMB,i);

         }

THEN

      for (int j=0;j<length;j++)
      {
         double weight=GetTickValue (Pair[j],shift)/weight_calc;

It says: 'weight_calc' - undeclared identifier. But It was declared?

 

I have more, but I ashamed to disturbe you, too much.

Thanks.
  

Can somebody help? Thanks
 

TimeLocal() returns datetime, not int.

Either this line is inside some cycle, condition or function:

double weight_calc=0;

Or this line is inside some different function:

double weight=GetTickValue (Pair[j],shift)/weight_calc;
Reason: