My last script assumed you only wanted the last row in a series to retain the calculated color. To accomplish what your latest specification, I just commented out the lines that reset the colors if the script determined it wasn't the last row in the series.

names default to here(1);
dt = current data table();
// Créez une nouvelle colonne pour l'indicateur
dt << New Column("Indicateur", Character, Nominal);
one_color = "xyz";
icolor = 0;
For Each Row(
// If the value of Article has changed set icolor to 0
If( Lag( :Article ) != :Article,
icolor = 0
);
// If status is red, increment icolor else set it back to zero
If( :status == "red",
icolor++,
icolor = 0
);
// Check for the number of icolor
// Set the value for the cell to the appropriate color
// When a color is specified remove no longer correct cell colors
// for previous rows
If(
icolor >= 5,
dt:Indicateur << color cells("red",row());
//dt:Indicateur << color cells("",row()-1);
/*If( icolor == 5,
dt:Indicateur << color cells("",row()-2);
);*/,
icolor >= 3,
dt:Indicateur << color cells("yellow",row());
//dt:Indicateur << color cells("",row()-1);
);
);
Jim