What you have described sounds like an illegal detention and search, though of course I have heard only your side, not theirs. They might claim they say you make an actual violation, but decided to let you go with a warning. That is completely legal. The claim that lack of a ticket issued to you, means that you committed no traffic violation, is a weak position I would not expect to win if it stood alone. However, the totality of circumstances, including any contradictions between the officers, could make this a winning claim. The question is, in what sort of proceeding could you raise it.
If you were charged with a criminal offense from this incident, you might use the unlawful police conduct to win an order suppressing the evidence against you. Since you are not being charged that is not an option.
You theoretically could sue, but the amount of damages for a short detention like you describe are so low that you would have trouble finding an attorney willing to proceed on this for you.
You should document what happened by writing out a statement of facts while the events are still fresh in your mind. If it happens again, then you have a pattern of misconduct which would be a better subject for a lawsuit than a single event. You might, if you choose, complain to higher police authorities about it, but that might backfire by bringing you unwanted attention by friends of the officers you complain about. Good luck.
Contact me at 248-399-6930 for a free consultation. You and I do not have an attorney-client relationship formed by our communications on this website. Advice given by me on this website is general advice based on partial information. You should not rely on any advice given without first hiring a lawyer in the area where the case is pending, and providing that lawyer with full information.