@lainz: The 10 is only in the example, really it is unknown in advance, so I need the counter.
@Thaddy: I need a function, because it (Lazarus DLL) has to communicate with an other program (MT4). I think procedure is not good for it (maybe I'm wrong).
So, what is the solution of my question?