1 Warning message

 

I have no idea string that warning

I try TimeToStr or String or Int..... not working

string period = (Period());
int ip=0;

switch(ip) 
   {
      case PERIOD_M1:  period="M1"  ; break;
      case PERIOD_M5:  period="M5"  ; break;
      case PERIOD_M15: period="M15" ; break;
      case PERIOD_M30: period="M30" ; break;
      case PERIOD_H1:  period="H1"  ; break;
      case PERIOD_H4:  period="H4"  ; break;
      case PERIOD_D1:  period="D1"  ; break;
      case PERIOD_W1:  period="W1"  ; break;
      case PERIOD_MN1: period="MN"  ; break;
   }
Print("Period is ",period);

Pink highlight - warning message

implicit conversion from 'number' to 'string' squarecomment.mq4 98 18

 
int Period()
string period = "";

switch(Period()) 
   {
      case PERIOD_M1:  period="M1"  ; break;
      case PERIOD_M5:  period="M5"  ; break;
      case PERIOD_M15: period="M15" ; break;
      case PERIOD_M30: period="M30" ; break;
      case PERIOD_H1:  period="H1"  ; break;
      case PERIOD_H4:  period="H4"  ; break;
      case PERIOD_D1:  period="D1"  ; break;
      case PERIOD_W1:  period="W1"  ; break;
      case PERIOD_MN1: period="MN"  ; break;
   }
Print("Period is ",period);
 
Marco vd Heijden:

Hi Marco.... Thank you very much again...


closed case

 

Always write self-documenting code
          Need some help with some MT5 code - MT5 - Expert Advisors and Automated Trading - MQL5 programming forum

and your code simplifies to:

Print("Period is ",as_string(_Period) );
 
May someone help Me to teach this thing as I wanna learn please
 
William Roeder:

Always write self-documenting code
          Need some help with some MT5 code - MT5 - Expert Advisors and Automated Trading - MQL5 programming forum

and your code simplifies to:

ok thank

 
0824053461:
May someone help Me to teach this thing as I wanna learn please

U can learn Udemy - course have mql4 programming. You can try it

This one I study and familiar to improve my programming.

Reason: