If you want to only open a stop/limit order in one particular bar, then you can use this:

if(CONDITION)
enterlong(x) //x>0 for a stop order, x<0 for a limit order
else
enterlong() //Whatever your usual entry may be

Entry and LimitOrders are global switches, so you have to change them whenever you donīt need them.

Hope this helps.