Is it possible to get list of unique magic number?

 
Lets say i have 10 orders

Magic Numbers are

1001
1002
1001
1003
1001
1004
1003
1002
1005
1004

i would like to see the result like this

1001
1002
1003
1004
1005

Just want to check if it's possible or not?

Thanks in advance
 

It is certainly possible.

 
Thanks. Could you please help me with this? Any code? I should have asked in my first post...
 

The code assumes that the expert has sole use of the trading thread.

double SeqNum() {
  double dSeqNum=1;
  
  if(GlobalVariableCheck("_SequenceNumber")) {
    dSeqNum=GlobalVariableGet("_SequenceNumber")+1;
    if(dSeqNum==1) dSeqNum=-1;
  }
  if((dSeqNum>0) && (GlobalVariableSet("_SequenceNumber",dSeqNum) == 0)) dSeqNum=-1;
  if(dSeqNum==-1) Print("Error ",GetLastError());
  return(dSeqNum);
}
 

Thanks for the code. I believe you are trying to generate a sequence series. What I need is to get the unique magic numbers from all the orders. Let see I have following magic numbers for open and pending orders

1010

1020

1030

1010

1040

1050

1060

1040

1060

I need to find a way to get unique magic numbers and they are from above

1010

1020

1030

1040

1050

1060

I hope you understand my problem. Thanks for help again

 

What do the "From" set of numbers refer to, as they are not unique (1010x2, 1020x1, 1030x1, 1040x2, 1050x1, 1060x2)?

 

Read all the numbers into an array

Sort the array

Read the numbers into another array, ignoring duplicates

You now have an array of sorted unique numbers

Reason: