Skip to content

Commit

Permalink
Update FxSymbol.mqh (#37)
Browse files Browse the repository at this point in the history
Trade execution mode defines how we set SL/TP for orders hence it's a must.
  • Loading branch information
yerden authored and dingmaotu committed Apr 9, 2018
1 parent 2ff32c6 commit e89e4f4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Trade/FxSymbol.mqh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Module: Trade/FxSymbol.mqh |
//| This file is part of the mql4-lib project: |
//| https://github.com/dingmaotu/mql4-lib |
Expand Down Expand Up @@ -62,6 +62,13 @@ public:
static bool isTradeLongOnly(string symbol) {return getTradeMode(symbol)==SYMBOL_TRADE_MODE_LONGONLY;}
static bool isTradeCloseOnly(string symbol) {return getTradeMode(symbol)==SYMBOL_TRADE_MODE_CLOSEONLY;}

//-- execution mode
static ENUM_SYMBOL_TRADE_EXECUTION getTradeExeMode(string symbol) {return(ENUM_SYMBOL_TRADE_EXECUTION)SymbolInfoInteger(symbol,SYMBOL_TRADE_EXEMODE);}
static bool isTradeExeMarket(string symbol) {return getTradeExeMode(symbol)==SYMBOL_TRADE_EXECUTION_MARKET;}
static bool isTradeExeInstant(string symbol) {return getTradeExeMode(symbol)==SYMBOL_TRADE_EXECUTION_INSTANT;}
static bool isTradeExeRequest(string symbol) {return getTradeExeMode(symbol)==SYMBOL_TRADE_EXECUTION_REQUEST;}
static bool isTradeExeExchange(string symbol) {return getTradeExeMode(symbol)==SYMBOL_TRADE_EXECUTION_EXCHANGE;}

static double getInitialMargin(string symbol) {return SymbolInfoDouble(symbol,SYMBOL_MARGIN_INITIAL);}
static double getMaintenanceMargin(string symbol) {return SymbolInfoDouble(symbol,SYMBOL_MARGIN_MAINTENANCE);}

Expand Down Expand Up @@ -149,6 +156,13 @@ public:
bool isTradeLongOnly() const {return isTradeLongOnly(m_symbol);}
bool isTradeCloseOnly() const {return isTradeCloseOnly(m_symbol);}

//-- execution mode
ENUM_SYMBOL_TRADE_EXECUTION getTradeExeMode() const {return getTradeExeMode(m_symbol);}
bool isTradeExeMarket() const {return isTradeExeMarket(m_symbol);}
bool isTradeExeInstant() const {return isTradeExeInstant(m_symbol);}
bool isTradeExeRequest() const {return isTradeExeRequest(m_symbol);}
bool isTradeExeExchange() const {return isTradeExeExchange(m_symbol);}

double getInitialMargin() const {return getInitialMargin(m_symbol);}
double getMaintenanceMargin() const {return getMaintenanceMargin(m_symbol);}
double getHedgedMargin() {return getHedgedMargin(m_symbol);}
Expand Down

0 comments on commit e89e4f4

Please sign in to comment.