Hi coders, good day to you. Let's say :-
I've 4 Symbols with Open Trades now :-
My EA has a total of 12 trading symbols readily for trading (set up in user input variable) :-
I created a new array :-
The purpose of the nonOpSym[] is to store the symbols without any open trades. Therefore, the expected output should be the balance of 8 symbols as follows :-
Now, how am I going to filter out the symbols of opSym[] from trSym[] in order to get the nonOpSym[] ?
I tried the following way but failed :-
Could you please help to correct my loop ? Thanks
I've 4 Symbols with Open Trades now :-
Inserted Code
string opSym[]={"AUDCHF","CADCHF","EURUSD","GBPJPY"};
My EA has a total of 12 trading symbols readily for trading (set up in user input variable) :-
Inserted Code
string trSym[]={"AUDCAD","AUDCHF","AUDJPY","CADCHF","CADJPY","EURCAD","EURGBP","EURUSD","GBPAUD","GBPJPY","USDCAD","USDJPY"};
I created a new array :-
Inserted Code
string nonOpSym[]; ArrayResize(nonOpSym,0);
The purpose of the nonOpSym[] is to store the symbols without any open trades. Therefore, the expected output should be the balance of 8 symbols as follows :-
Inserted Code
string nonOpSym[]={"AUDCAD","AUDJPY","CADCHF","EURCAD","EURGBP","GBPAUD","USDCAD","USDJPY"};
Now, how am I going to filter out the symbols of opSym[] from trSym[] in order to get the nonOpSym[] ?
I tried the following way but failed :-
Inserted Code
for(int h=0; h<ArraySize(opSym); h++) { for(int i=0; i<ArraySize(trSym); i++) { if(opSym[h]!=trSym[i]) continue; {ArrayResize(nonOpSym,ArraySize(nonOpSym)+1); nonOpSym[ArraySize(nonOpSym)-1]=trSym[i];} } }
Could you please help to correct my loop ? Thanks