Skip to content

Commit

Permalink
Improve MT4/MT5 compatibility: AccountFreeMarginMode is not defined i…
Browse files Browse the repository at this point in the history
…n MT5, and second parameter of FileReadDouble is not necessary
  • Loading branch information
dingmaotu committed Apr 7, 2019
1 parent acea728 commit 78847e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Trade/Account.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public:
static double getEquity() {return AccountInfoDouble(ACCOUNT_EQUITY);}
static double getMargin() {return AccountInfoDouble(ACCOUNT_MARGIN);}
static double getFreeMargin() {return AccountInfoDouble(ACCOUNT_MARGIN_FREE);}
#ifdef __MQL4__
static int getFreeMarginCalcMode() {return AccountFreeMarginMode();}
#endif
static double getMarginLevel() {return AccountInfoDouble(ACCOUNT_MARGIN_LEVEL);}
static double getMarginCallLevel() {return AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL);}
static double getMarginStopoutLevel() {return AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);}
Expand Down
4 changes: 2 additions & 2 deletions Utils/File.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public:
BinaryFile(string name,int flags):File(name,flags|FILE_BIN){}
void reopen(string name,int flags) {reopen(name,flags|FILE_BIN);}

double readDouble(int size=DOUBLE_VALUE) const {return FileReadDouble(m_handle,size);}
double readDouble() const {return FileReadDouble(m_handle);}
float readFloat() const {return FileReadFloat(m_handle);}
long readLong() const {return FileReadLong(m_handle);}
int readInteger(int size=INT_VALUE) const {return FileReadInteger(m_handle,size);}
Expand All @@ -96,7 +96,7 @@ public:
template<typename T>
uint readStruct(T &value,int size=-1) const {return FileReadStruct(m_handle,value,size);}

uint writeDouble(double value,int size=DOUBLE_VALUE) {return FileWriteDouble(m_handle,value,size);}
uint writeDouble(double value) {return FileWriteDouble(m_handle,value);}
uint writeFloat(float value) {return FileWriteFloat(m_handle,value);}
uint writeInteger(int value,int size=INT_VALUE) {return FileWriteInteger(m_handle,value,size);}
uint writeLong(long value) {return FileWriteLong(m_handle,value);}
Expand Down

0 comments on commit 78847e6

Please sign in to comment.