I want to call SymbolInfoString () for another currency pair, but I'm having trouble onthe tester.
Please insert the code correctly: when editing a message, press the button and paste your code into the pop-up window.
Are you probably talking about an old terminal (MQ4)?
Are you probably talking about an old terminal (MQ4)?
Added the code.
This is MQL5.
Added an MQ5 file.
The pair used is EURUSD, and account currency is JPY.
In my environment, just having follow code causes a similar error.
string profit = SymbolInfoString("USDJPY", SYMBOL_CURRENCY_PROFIT);
If the code is valid, there is no profit.
If the code is invalid, there is profit.
Load an indicator like iATR to make the environment load the data for you.
I was able to get the information by adding iClose().
Thanks so much.
But I sigh...
string account = AccountInfoString(ACCOUNT_CURRENCY); string margin = SymbolInfoString(_Symbol, SYMBOL_CURRENCY_MARGIN); string profit = SymbolInfoString(_Symbol, SYMBOL_CURRENCY_PROFIT); string marginPair = ""; for(int i = SymbolsTotal(false); i >= 0; i--) { string sym = SymbolName(i, false); string otherBase = SymbolInfoString(sym, SYMBOL_CURRENCY_BASE); string otherProfit = SymbolInfoString(sym, SYMBOL_CURRENCY_PROFIT); if((otherBase == profit && otherProfit == account) || (otherBase == account && otherProfit == profit)) { accountPair = sym; //Necessary information } else if((otherBase == margin && otherProfit == account) || (otherBase == account && otherProfit == margin)) { marginPair = sym; } } double close1 = iClose(accountPair, PERIOD_CURRENT, 1); double close2 = iClose(marginPair, PERIOD_CURRENT, 1);
- 2021.05.04
- www.mql5.com
Just a friendly reminder to use the Link tool (Ctrl-K) when adding links so that they clickable. Otherwise we have to copy/paste them into the address bar.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to call SymbolInfoString () for another currency pair, but I'm having trouble onthe tester.
If EA call SymbolInfoString () for another currency pair, its currency pair will appear on MarketWatch.
However, its price is not displayed and but also cannot be used to calculate the profit and loss of positions.
error message: "no prices for symbol USDJPY (1970.01.01 00:00:00 0.00000, 0.00000)"
Please tell me the workaround.
I want to get a currency pair of account currency and profit currency of current currency pair.