How do i limit the number of trades in a trading range even when the siginal criteria is still met mql5


im tring to write a mql5 code based of rsi... i want the EA to only take two trades max a day even when more siginal criteria still pop up... further more, a max of one sell order and one buy order. How do i go about that... my code apparanently takes as many trades as possible as long as the criteria is met