2026-03-10 13:47:42 +07:00
|
|
|
#ifndef EA_ICT_CL__MARKET_MQH
|
2026-03-10 20:51:27 +07:00
|
|
|
#define EA_ICT_CL__MARKET_MQH
|
2026-03-10 13:47:42 +07:00
|
|
|
|
2026-03-10 20:51:27 +07:00
|
|
|
inline double GetBid(const string symbol) { return SymbolInfoDouble(symbol, SYMBOL_BID); }
|
|
|
|
|
inline double GetAsk(const string symbol) { return SymbolInfoDouble(symbol, SYMBOL_ASK); }
|
|
|
|
|
inline double GetPoint(const string symbol) { return SymbolInfoDouble(symbol, SYMBOL_POINT); }
|
|
|
|
|
inline int GetDigits(const string symbol) { return (int)SymbolInfoInteger(symbol, SYMBOL_DIGITS); }
|
2026-03-10 13:47:42 +07:00
|
|
|
|
2026-03-10 20:51:27 +07:00
|
|
|
/** Returns spread in points (ask - bid) / point. */
|
2026-03-10 13:47:42 +07:00
|
|
|
inline double GetSpreadPoints(const string symbol)
|
|
|
|
|
{
|
2026-03-10 20:51:27 +07:00
|
|
|
const double bid = GetBid(symbol);
|
|
|
|
|
const double ask = GetAsk(symbol);
|
|
|
|
|
const double pointSize = GetPoint(symbol);
|
|
|
|
|
if (pointSize <= 0.0) return 0.0;
|
|
|
|
|
return (ask - bid) / pointSize;
|
2026-03-10 13:47:42 +07:00
|
|
|
}
|
|
|
|
|
|
2026-03-10 20:51:27 +07:00
|
|
|
/** True if terminal, EA and symbol allow trading. */
|
2026-03-10 13:47:42 +07:00
|
|
|
inline bool IsTradeAllowedNow(const string symbol)
|
|
|
|
|
{
|
2026-03-10 20:51:27 +07:00
|
|
|
if (!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) return false;
|
|
|
|
|
if (!MQLInfoInteger(MQL_TRADE_ALLOWED)) return false;
|
|
|
|
|
if (!SymbolInfoInteger(symbol, SYMBOL_TRADE_MODE)) return false;
|
|
|
|
|
return true;
|
2026-03-10 13:47:42 +07:00
|
|
|
}
|
|
|
|
|
|
2026-03-10 20:51:27 +07:00
|
|
|
#endif
|