Signal exit problem

Trying to code a buy signal using multicharts on daily bars

Nothing fancy

Using 10 bars exit


if c<average(c,50) and stoch(c,14)<30 then 
buy ("LE1") 1 contract next bar at market; 
  
if TimeToMinutes(date) - TimeToMinutes(OpenEntrydate(0)) >= 10 
then sell from entry ("LE1") 1 contract total next bar at market;

but whn there are subsequent buy similar buy signals before the first buy exit within 10 bars exit, all the subsequent buy signals exit together on the 10 bars rather than exit individually 10 bars from their entries

Whats wrong?