Cannot get first in first out strategy to work with hedging

dasani daniel  

I am running a long-only strategy that opens multiple long trades, and then sells them off one by one. The first position it sells should correspond with the ticket of the first position it had opened.

I have been browsing the forums for literally hours on end, as well as documentation, but have been unable to get it to work (Tried mostly with CTrade functions).

Can anyone point me in the right direction?