Discussion of article "Migrating from MQL4 to MQL5" - page 3

 
MT4Orders
MT4Orders
  • votes: 27
  • 2016.10.10
  • fxsaber
  • www.mql5.com
Parallel use of the MetaTrader 4 and MetaTrader 5 order systems.
 

please correct

bool IsTesting()
bool MQLInfoInteger(MQL5_TESTING)
IsTesting
Returns TRUE if an Expert Advisor is running in the testing mode, otherwise returns FALSE.
MQLInfoInteger

bool IsTesting()
 MQLInfoInteger(MQL_TESTER)
IsTesting
Returns TRUE if an Expert Advisor is running in the testing mode, otherwise returns FALSE.
MQLInfoInteger

MQL5_TESTING dont work please change it to MQL_TESTER.
IsTesting - Checkup - MQL4 Reference
IsTesting - Checkup - MQL4 Reference
  • docs.mql4.com
IsTesting - Checkup - MQL4 Reference
 
Enum MAIN_SIGNAL_MODE { MODE_MAIN , MODE_SIGNAL}; 

enum ADX_MODE        { MODE_MAIN,         MODE_PLUSDI, MODE_MINUSDI };

2 same definition create error fix this error please.
 

Thank you,

Your hard work in this article is very helpful :)

 

Hi Everyone,

do you know how to use ObjectSet(objname,OBJPROP_FIRSTLEVEL+level,value) in MQL5? i tried to search OBJPROP_FIRSTLEVEL but don't find it in MQL5

mql4: 

void _SetFibLevel(string objname, int level, double value, string description)

//+------------------------------------------------------------------+

{

    ObjectSet(objname,OBJPROP_FIRSTLEVEL+level,value);

    ObjectSetFiboDescription(objname,level,description);

}

-----------------------------------

 
vietlh216:

do you know how to use ObjectSet(objname,OBJPROP_FIRSTLEVEL+level,value) in MQL5? i tried to search OBJPROP_FIRSTLEVEL but don't find it in MQL5

mql4: 

void _SetFibLevel(string objname, int level, double value, string description)

//+------------------------------------------------------------------+

{

    ObjectSet(objname,OBJPROP_FIRSTLEVEL+level,value);

    ObjectSetFiboDescription(objname,level,description);

}

-----------------------------------


You can read my blogpost for a ready-made solution.

 
Stanislav Korotky:

You can read my blogpost for a ready-made solution.


Very useful, thanks :)

 
Stanislav Korotky:

You can read my blogpost for a ready-made solution.


Thanks Stanislav Korotky for your solution, but i am not good much in MQL5 and i still don't know how to convert OBJPROP_FIRSTLEVEL to use in MQL5. i don't find the same object property to convert it

in mql4: 

OBJPROP_FIRSTLEVEL+n

210+n

int

Integer value to set/get the value of Fibonacci object level with index n. Index n can be from 0 (number of levels -1), but not larger than 31

but i don't find it in MQL5

ex:  MQL4  :   ObjectSetFiboDescription(objname,level,description);->MQL5: ObjectSetString(0,objname,OBJPROP_LEVELTEXT,level,description);

MQL4: ObjectSet(objname,OBJPROP_FIRSTLEVEL+level,value); -> MQL5: ???

 
vietlh216:

Thanks Stanislav Korotky for your solution, but i am not good much in MQL5 and i still don't know how to convert OBJPROP_FIRSTLEVEL to use in MQL5. i don't find the same object property to convert it

in mql4: 

OBJPROP_FIRSTLEVEL+n

210+n

int

Integer value to set/get the value of Fibonacci object level with index n. Index n can be from 0 (number of levels -1), but not larger than 31

but i don't find it in MQL5

ex:  MQL4  :   ObjectSetFiboDescription(objname,level,description);->MQL5: ObjectSetString(0,objname,OBJPROP_LEVELTEXT,level,description);

MQL4: ObjectSet(objname,OBJPROP_FIRSTLEVEL+level,value); -> MQL5: ???


ah, I find it 

ObjectSetDouble(0,objname,OBJPROP_LEVELVALUE,level,value); 

^^

 
vietlh216:

ah, I find it 

ObjectSetDouble(0,objname,OBJPROP_LEVELVALUE,level,value); 

^^


You can try the following addendum to my include:

class OBJPROP_DOUBLE_BROKER_EXTENDED: public OBJPROP_DOUBLE_BROKER
{
  public:
    OBJPROP_DOUBLE_BROKER_EXTENDED(const ENUM_OBJECT_PROPERTY_DOUBLE property, const int modifier): OBJPROP_DOUBLE_BROKER(property, modifier)
    {
    }
    
    OBJPROP_DOUBLE_BROKER_EXTENDED *operator+(const int add)
    {
      i = add;
      return &this;
    }
};

OBJPROP_DOUBLE_BROKER_EXTENDED OBJPROP_FIRSTLEVEL(OBJPROP_LEVELVALUE, 0);

After this your inital MQL4 code should work as is.