implicit enum conversion warning

 
extern ENUM_TIMEFRAMES TFofFractalsorCandlesforTrail=ENUM_TIMEFRAMES (PERIOD_M15);
if (TFofFractalsorCandlesforTrail==0)TFofFractalsorCandlesforTrail=Period();

MQ4:

The above code generates a warning "implicit enum conversion: warning.

Any advises on how the warning can be cleared

 
extern ENUM_TIMEFRAMES TFofFractalsorCandlesforTrail = PERIOD_M15;
 
Marco vd Heijden:

That's better but that's not where the implicit conversion is coming from. 

 
  1. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. extern ENUM_TIMEFRAMES TFofFractalsorCandlesforTrail=ENUM_TIMEFRAMES (PERIOD_M15);

    Period_M15 is an ENUM_TIMEFRAMES. No need for the cast.

  3. if (TFofFractalsorCandlesforTrail==0)TFofFractalsorCandlesforTrail=Period();
    Period() is an int. Cast it to the proper enumeration.  Don't hard code numbers; zero is PERIOD_CURRENT; use the proper enumeration.
 
William Roeder:
  1. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. Period_M15 is an ENUM_TIMEFRAMES. No need for the cast.

  3. Period() is an int. Cast it to the proper enumeration.  Don't hard code numbers; zero is PERIOD_CURRENT; use the proper enumeration.

1. Well Taken. Will Take Care.

2. Updated to:

extern ENUM_TIMEFRAMES TFofFractalsorCandlesforTrail=PERIOD_M15;

3.Updated to:

int TFofFractalsorCandlesforTrail1=TFofFractalsorCandlesforTrail;
if (TFofFractalsorCandlesforTrail==PERIOD_CURRENT)TFofFractalsorCandlesforTrail1=Period();		

Thanks and Credits to all of you for your quick and selfless support in troubleshooting:

1) https://www.mql5.com/en/users/thecreator1

2) https://www.mql5.com/en/users/nicholishen

3) https://www.mql5.com/en/users/whroeder1

May you all with family be infinitely blessed with lots of inner peace, love, health, abundance, prosperity.....

Marco vd Heijden
Marco vd Heijden
  • www.mql5.com
Published product MT4 to Telegram allows you to broadcast your trades to a Telegram Channel or Group. Can be used to build, support and expand your own network of traders. A Group can have 200.000 members, A Channel can have an unlimited number of subscribers...
 
if (TFofFractalsorCandlesforTrail==PERIOD_CURRENT)TFofFractalsorCandlesforTrail1=Period();	

You've ignored the first two sentences of #3.3

 
William Roeder:

You've ignored the first two sentences of #3.3

int TFofFractalsorCandlesforTrail1=TFofFractalsorCandlesforTrail;
if (TFofFractalsorCandlesforTrail==PERIOD_CURRENT)TFofFractalsorCandlesforTrail1=Period();      

With this the warning is not anymore there. Do you feel any further improvements?

 
Shine Scariah:

With this the warning is not anymore there. Do you feel any further improvements?

Thank you. The thread is closed.
Reason: