There have been multiple requests for this exact thing in the forum. However you are the very first of those posts to provide the actual specifications. Thank you!
Here is the code to translates your specifications directly into a chart study script:
input numberOfDays = 6;
def downTrend = close < close[numberOfDays]; def upTrend = close > close[numberOfDays];
plot buySignal = downTrend[1] and low < low[1] and close > low[1];
buySignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
buySignal.SetDefaultColor(Color.WHITE);
buySignal.SetLineWeight(3);
plot sellSignal = upTrend[1] and high > high[1] and close < high[1];
sellSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
sellSignal.SetDefaultColor(Color.WHITE);
sellSignal.SetLineWeight(3);
There is a user adjustable input "number of days", which you can use to adjust for the "multiple days" element of your specification.