Thanat Thitithammaphong: StringConcatenate format error. Please suggest a solution for me.
Please read the documentation on StringConcatenate. It does not return a string. That is the way the function works in MQL4 but it is different in MQL5. In MQL5 you pass the resulting string reference as an argument parameter, so you would have to refer to it twice if you want it included in the result. In your case you might want to consider using StringAdd instead.
Documentation on MQL5: String Functions / StringConcatenate
- www.mql5.com
StringConcatenate - String Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Untested and uncompiled. Just serves as an example:
// Option 1 int string_length = StringConcatenate( func_symbol_list, func_symbol_list, PositionGetString(POSITION_SYMBOL), "," ); // Option 2 bool result = StringAdd( func_symbol_list, PositionGetString(POSITION_SYMBOL) + "," ); // Option 3 func_symbol_list += PositionGetString(POSITION_SYMBOL) + ",";
int TotalSymbolOpeningOrders(int magic) { int func_total_orders=0; string func_symbol_list=""; for(int func_i=PositionsTotal()-1;func_i>=0;func_i--){ ulong tick=PositionGetTicket(func_i); if(PositionSelectByTicket(tick)){ if(StringFind(func_symbol_list,PositionGetString(POSITION_SYMBOL))==-1 && PositionGetInteger(POSITION_MAGIC)==magic && (PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY ||PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL)) { func_total_orders++; func_symbol_list += PositionGetString(POSITION_SYMBOL) + ","; } } } return func_total_orders; }
func_symbol_list += PositionGetString(POSITION_SYMBOL) + ",";
working ..
Thank you.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
StringConcatenate format error.
Please suggest a solution for me.
Thank you.