Get the base currency from a Symbol in MQL

I want to know what base currency of the Symbol.

I need this because depending of the base currency I will use a Risk % per trade. My broker have stocks from UK, US and EUR. Each one of this is in different currency and my money function always is considering my account currency (USD), so is not exactly the % I want to risk.

Is there a function to do this? I have look but not found anything. Please help.

const string base = StringSubstr(symbol,0,3);
const string quote = StringSubstr(symbol,3);

Thank you. I checked that, but for some reason is not working in my code. For example I want to check if the last 4 strings of the symbol are “UK-d” and it doesn’t work.

This might work:

string currency=SymbolInfoString(_Symbol,SYMBOL_CURRENCY_BASE);

I don’t know what is wrong. My broker have FX, futures and Stocks from UK, EUR and US. And I want a risk per trade calculation for everything. This is the part of the code that is giving me trouble. “PorcentajeRiesgo” variable is a input of course.

Type of ‘PorcentajeRiesgo’?

Is embarrassing to say but I didn’t know and maybe help someone else. The code works, I was using my expert and the money management is a #include file. I was just compiling the include file and not the expert. Seems that make the code work as intended. Thank you for the help guys!