- one trade per day...
- How can I run the same EA with different settings on the same pair?
- How to check magic numbers of open positions
-
The result is exactly as expected. You start with an array with an initial zero element, insert uniquely into the array, and then delete the last value (a ten).
-
for (int x=0; x<arrSize && tempMagic>0; x++)
I have no idea why you try to uniquely insert n² times. Once is sufficient.
-
I suggest you instead start with an empty array, insert all elements, sort the array once, and then remove the duplicates.
Not tested, not compiled, just typed.
#define INDEX uint template<typename Ti, typename To> INDEX unique_copy(const Ti& inp[], INDEX iBeg, INDEX iEnd, To& out[], INDEX oBeg){ if(iBeg == iEnd) return oBeg; Ti prev = out[oBeg++] = inp[iBeg]; while(++iBeg != iEnd){ if(!(prev == inp[iBeg]) ) prev = out[oBeg++] = inp[iBeg]; } return oBeg; } /////////////////////////////////////////////// long mNumber[]; int arrSize=0; for(int cycle = PositionsTotal()-1; cycle>=0; --cycle) if(PositionGetSymbol(cycle) == _Symbol) { long tempMagic = PositionGetInteger(POSITION_MAGIC); if(tempMagic > 0){ ArrayResize(mNumber, arrSize+1); mNumber[arrSize++] = PositionGetInteger(POSITION_MAGIC); } } ArraySort(mNumber) arrSize = unique_copy(mNumber, 0, size, mNumber, 0); ArrayResize(mNumber,arrSize); ArrayPrint(mNumber);
Not tested, not compiled, just typed.
-
The result is exactly as expected. You start with an array with an initial zero element, insert uniquely into the array, and then delete the last value (a ten).
-
I have no idea why you try to uniquely insert n² times. Once is sufficient.
-
I suggest you instead start with an empty array, insert all elements, sort the array once, and then remove the duplicates.
Not tested, not compiled, just typed.
Not tested, not compiled, just typed.
I got your point, thanks mate

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use