Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trade: add trade execution mode in FxSymbol.mqh #37

Merged
merged 1 commit into from
Apr 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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