mql4-lib
mql4-lib copied to clipboard
"Invalid Point access" error on calling SymbolAnalyzer::getConversionSymbol of FxSymbol module
I try to trace the code of SymbolAnalyzer::buildCurrencyIndex
of FxSymbol
module then find symbol is added into m_spacials
HashMap rather than building m_index
if Base currency equals to Profit currency of the given symbol.
However, broker "IG Market" provides symbols all having Base currency being the same to Profit currency, which cause zero size to m_index HashMap, so Invalid Point access error occurs when calling SymbolAnalyzer::getConversionSymbol
, as the member function uses pointers to refer to a zero-size map (i.e., m_index
).
May I know what is m_spacials
used for? as I don't see any access or operation to it on given code. appreciated if you would like to provide example or explanation to SymbolAnalyzer
I modify getBaseCurrency
member function in FxSymbol
class as the workaround to fix the issue that broker falsely return a wrong base currency via SymbolInfoString(symbol,SYMBOL_CURRENCY_BASE)
static string getBaseCurrency(string symbol)
{
string s ;
s = SymbolInfoString(symbol,SYMBOL_CURRENCY_BASE);
if(FxSymbol::getMarginCalcMode(symbol) == 0 &&
StringCompare(s, SymbolInfoString(symbol,SYMBOL_CURRENCY_PROFIT))== 0)
{
s = StringSubstr(symbol, 0, 3) ;
}
return(s);
}