You can try this script bro :
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { string opSym[6] = { "AUDJPY", "CADJPY", "CHFJPY", "GBPJPY", "NZDCHF", "NZDJPY"}; double symOpPxAr[][3]; int totalorder = OrdersTotal(); ArrayResize(symOpPxAr,totalorder); for(int i=0; i<totalorder; i++) { if ( !OrderSelect(i,SELECT_BY_POS,MODE_TRADES) ) continue; if ( OrderMagicNumber() != mn ) continue; for(int j=0; j<ArraySize(opSym); j++) if ( OrderSymbol()==opSym[j] ) { symOpPxAr[i,0] = OrderOpenPrice(); symOpPxAr[i,1] = j; symOpPxAr[i,2] = OrderType(); } } if(ArraySize(symOpPxAr)>0) ArraySort(symOpPxAr,WHOLE_ARRAY,0,MODE_DESCEND); // Big ... Small for(int i=0; i<ArraySize(opSym); i++) { string text = opSym[i] + ":"; for(int j=0; j<totalorder; j++) { if ( opSym[(int)symOpPxAr[j,1]] == opSym[i] ) text += DoubleToString(symOpPxAr[j,0],5) + ","; } Print(text); } }
Files:
Test.mq4
2 kb

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
Existingly, I have 3 symbols that with open orders :-
1) AUDNZD : 10 BUY open orders
2) EURUSD : 8 SELL open orders
3) XAUUSD : 12 BUY open orders and 3 SELL open orders
The following are my codes :-
After storing the OrderOpenPrice() into respective arrays, I need to sort it in MODE_DESCEND and MODE_ASCEND (If in Ascending order, how to exclude the 0 values ? I don't know how to deal with this issue, please advise).
The problem now is if I print / call out from the arrays, I can get the correct output for the 1st pair (AUDNZD), but I cannot get the output for other pairs.
Lastly, there are total of 3 symbols that with open orders. For bSymOpPxAr[][99], there are only 2 symbols with BUY orders (AUDNZD and XAUUSD) and for sSymOpPxAr[][99], there are only 2 symbols with SELL orders (EURUSD and XAUUSD), how to turn the :-
1) bSymOpPxAr[][99] to become bSymOpPxAr[][2] ?
2) sSymOpPxAr[][99] to become sSymOpPxAr[][2] ?
Kindly have a look into my codes, please help and correct my codes, thank you.