Skip to content

Commit

Permalink
Fix MQL language compatibility with latest version of MT4 (no automat…
Browse files Browse the repository at this point in the history
…ic conversion of integer to boolean)
  • Loading branch information
dingmaotu committed Apr 7, 2019
1 parent ff0710c commit acea728
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Lang/GlobalVariable.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public:

static bool makeTemp(string name) {return GlobalVariableTemp(name);}
static double get(string name) {return GlobalVariableGet(name);}
static bool get(string name,double &value) {return GlobalVariableGet(name,value);}
static datetime set(string name,double value) {return GlobalVariableSet(name,value);}
static bool get(string name,double &value) {return (bool)GlobalVariableGet(name,value);}
static bool set(string name,double value) {return (bool)GlobalVariableSet(name,value);}
static bool setOn(string name,double value,double check) {return GlobalVariableSetOnCondition(name,value,check);}

static bool remove(string name) {return GlobalVariableDel(name);}
static bool removeAll(string prefix=NULL,datetime before=0) {return GlobalVariablesDeleteAll(prefix,before);}
static bool remove(string name) {return (bool)GlobalVariableDel(name);}
static bool removeAll(string prefix=NULL,datetime before=0) {return (bool)GlobalVariablesDeleteAll(prefix,before);}
};
//+------------------------------------------------------------------+
//| TempVar is a variable whose life time is the same as the program |
Expand Down
18 changes: 9 additions & 9 deletions Trade/Terminal.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public:
static bool isStopped() {return IsStopped();}
static bool isConnected() {return IsConnected();}

static bool hasCommunityAccount() {return TerminalInfoInteger(TERMINAL_COMMUNITY_ACCOUNT);}
static bool isCommunityConnected() {return TerminalInfoInteger(TERMINAL_COMMUNITY_CONNECTION);}
static double getCommunityBalance() {return TerminalInfoDouble(TERMINAL_COMMUNITY_BALANCE);}
static bool hasCommunityAccount() {return (bool)TerminalInfoInteger(TERMINAL_COMMUNITY_ACCOUNT);}
static bool isCommunityConnected() {return (bool)TerminalInfoInteger(TERMINAL_COMMUNITY_CONNECTION);}
static double getCommunityBalance() {return (bool)TerminalInfoDouble(TERMINAL_COMMUNITY_BALANCE);}

static string getPath() {return TerminalInfoString(TERMINAL_PATH);}
static string getDataPath() {return TerminalInfoString(TERMINAL_DATA_PATH);}
Expand All @@ -51,13 +51,13 @@ public:
static string getTerminalCompany() {return TerminalInfoString(TERMINAL_COMPANY);}
static string getTerminalLanguage() {return TerminalInfoString(TERMINAL_LANGUAGE);}

static bool isDllAllowed() {return TerminalInfoInteger(TERMINAL_DLLS_ALLOWED);}
static bool isTradeAllowed() {return TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);}
static bool isEmailEnabled() {return TerminalInfoInteger(TERMINAL_EMAIL_ENABLED);}
static bool isFtpEnabled() {return TerminalInfoInteger(TERMINAL_FTP_ENABLED);}
static bool isDllAllowed() {return (bool)TerminalInfoInteger(TERMINAL_DLLS_ALLOWED);}
static bool isTradeAllowed() {return (bool)TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);}
static bool isEmailEnabled() {return (bool)TerminalInfoInteger(TERMINAL_EMAIL_ENABLED);}
static bool isFtpEnabled() {return (bool)TerminalInfoInteger(TERMINAL_FTP_ENABLED);}

static bool isNotificationsEnabled() {return TerminalInfoInteger(TERMINAL_NOTIFICATIONS_ENABLED);}
static bool hasMetaQuotesId() {return TerminalInfoInteger(TERMINAL_MQID);}
static bool isNotificationsEnabled() {return (bool)TerminalInfoInteger(TERMINAL_NOTIFICATIONS_ENABLED);}
static bool hasMetaQuotesId() {return (bool)TerminalInfoInteger(TERMINAL_MQID);}
static bool notify(string msg);
static bool mail(string subject,string content);

Expand Down
6 changes: 3 additions & 3 deletions UI/Chart.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public:
int getSubwindowHeight(int index=0) const {return(int)ChartGetInteger(m_chartId,CHART_HEIGHT_IN_PIXELS,index);}
bool setSubwindowHeight(int index,int height) {return ChartSetInteger(m_chartId,CHART_HEIGHT_IN_PIXELS,index,height);}

bool isOffline() const {return ChartGetInteger(m_chartId,CHART_IS_OFFLINE);}
bool isOffline() const {return (bool)ChartGetInteger(m_chartId,CHART_IS_OFFLINE);}

#define BOOL_PROP(PropName,OptionName) \
bool is##PropName() const {return ChartGetInteger(m_chartId,OptionName);}\
bool set##PropName(bool value) {return ChartSetInteger(m_chartId,OptionName,value);}
bool is##PropName() const {return (bool)ChartGetInteger(m_chartId,OptionName);}\
bool set##PropName(bool value) {return (bool)ChartSetInteger(m_chartId,OptionName,value);}

BOOL_PROP(ShowOHLC,CHART_SHOW_OHLC)
BOOL_PROP(ShowBidLine,CHART_SHOW_BID_LINE)
Expand Down

0 comments on commit acea728

Please sign in to comment.