I am developing a risk-mgt function in my EA. I have my EA run on several timeframes of different symbols. Whenever a potential trade is signalled, I want to calculate the Vale At Risk for my complete ‘portfolio’, meaning I need to get for instance the SYMBOL_TRADE_TICK_VALUE for other symbols.
For instance: I have open trades in EURUSD, GBPUSD en CADAUD. If the EA on EURUSD discovers a potential trade, I need (among things) the SYMBOL_TRADE_TICK_VALUE of GBPUSD to be able to calculate my portfolio VaR. But I get a 4106 error (unknown symbol). If I put the code in a script, it all works fine. What should I do? thanks!
(this is just code to get to the real reason of the error) THIS EA RAN ON EURUSD string CurrPortAssets[] = {“AUDCAD”, “EURUSD”, “GBPJPY”, “USDCAD”, “GBPUSD”, “CADCHF”}; double CurrPortLotSizes[] = { 0.1, -0.1, 0.15, 0.2 , 2.0, -8.0 }; //+ve - LONG, -ve - SHORT
double tickvalue = SymbolInfoDouble(“AUDCAD”,SYMBOL_TRADE_TICK_VALUE); Print("LastError: ", GetLastError()); THIS RETURNED ERROR 4106