Hi, does anyone have advice or an idea how I can make sure the next trade doesn't occur until either the SL or TP is hit?

My entry is such that if price touches an MA, trade is entered, but obviously it could do this many times in the course of a minute. The EA then places trades every time. It closes the previous order with the loss of the spread, and then opens a new order. How can i make sure a new entry is not made until the previous position closes due to either SL or TP?

thanks for any help.