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);
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);