indexes. It is known that it is best for MQL5 programmers to calculate non-forex tick value themselves instead of using this
SymbolInfoDouble ("",SYMBOL_TRADE_TICK_VALUE);
https://www.mql5.com/en/forum/227407#comment_6534392
"Must always be deposit currency.
However it's set by the broker and is not rare they provide wrong values, mainly for CFDs."
So to calculate ourselves we basically start with:
initial_calculated_tick_value = contract_size * tick_size
(We can get tick_size and contract_size with SymbolInfoDouble )
Then depending on the account currency and profit currency, we adjust from there. For instance, if the account currency matches the profit currency then we do not need to adjust anything the tick value is the initial calculated tick value.
If the account currency is USD and the profit currency is EUR then:
calculated_tick_value = initial_calculated_tick_value * EURUSD_price
If the account currency is USD and the profit currency is JPY then:
calculated_tick_value = initial_calculated_tick_value / USDJPY_price
If the account currency is BTC and the profit currency is USD then:
calculated_tick_value = initial_calculated_tick_value / BTCUSD_price
I hope you get the idea now. It is ideal if all popular combo of account currency (EUR,GBP,BTC,USD etc accounts) and profit currency is accounted for in the code
Here is what my tick val calc function looks like from my non SQX EA but I only have what I need here:
void c7calc::CalcTickV(void) { if((csyms[ccy.getsymn()].symcalcm==SYMBOL_CALC_MODE_FOREX || csyms[ccy.getsymn()].symcalcm==SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE || csyms[ccy.getsymn()].SymbolCurrencyProfit==AccountCurrency)) //&& SymbolInfoString(ccy.cursym,SYMBOL_SECTOR_NAME) != "Crypto") // if its forex or if account currency is the same as symbol profit currency, just reutnr the standard tick value { csyms[ccy.getsymn()].symtcval = SymbolInfoDouble(ccy.cursym,SYMBOL_TRADE_TICK_VALUE); return; } // if its not forex we calculate this ourselves double pticv = csyms[ccy.getsymn()].symcnsz * csyms[ccy.getsymn()].symtcsz; if(AccountCurrency!=csyms[ccy.getsymn()].SymbolCurrencyProfit) { if(AccountCurrency=="USD") { if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="EUR") pticv *= SymbolInfoDouble("EURUSD",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="GBP") pticv *= SymbolInfoDouble("GBPUSD",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="JPY") pticv /= SymbolInfoDouble("USDJPY",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="AUD") pticv *= SymbolInfoDouble("AUDUSD",SYMBOL_BID); else { Alert(omagic,cb,ccy.cursym," Unknown account and profit currency combo ",AccountCurrency,cb,csyms[ccy.getsymn()].SymbolCurrencyProfit); } } else if(AccountCurrency=="BTC") { if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="USD") pticv /= SymbolInfoDouble("BTCUSD",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="EUR") pticv /= SymbolInfoDouble("BTCEUR",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="GBP") pticv *= SymbolInfoDouble("GBPUSD",SYMBOL_BID) / SymbolInfoDouble("BTCUSD",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="JPY") pticv /= SymbolInfoDouble("BTCUSD",SYMBOL_BID) * SymbolInfoDouble("USDJPY",SYMBOL_BID); else if(csyms[ccy.getsymn()].SymbolCurrencyProfit=="HKD") pticv /= SymbolInfoDouble("BTCUSD",SYMBOL_BID) * SymbolInfoDouble("USDHKD",SYMBOL_BID); else { Alert(omagic,cb,ccy.cursym," Unknown account and profit currency combo ",AccountCurrency,cb,csyms[ccy.getsymn()].SymbolCurrencyProfit); } } else Alert(omagic,cb,ccy.cursym," Unknown account currency ",AccountCurrency,cb,csyms[ccy.getsymn()].SymbolCurrencyProfit); } csyms[ccy.getsymn()].symtcval = pticv; return; }
Anyways, it could be a lot of code to cover all the combos but I thought I'd open an official ticket to open discussion. In the meantime maybe just an input dropdown to select either divide or multiply and then a string input for the adjustment symbol would be OK in the EA settings?