Code:

```
#
# TD Ameritrade IP Company, Inc. (c) 2012-2022
#
declare lower;
input price = close;
input length = 30;
input slowingLength = 5;
input over_bought = 60;
input over_sold = 30;
def rainbow = reference RainbowAverage(price = price, averageType = AverageType.WEIGHTED);
plot Stochastic = Sum(rainbow - Lowest(rainbow, length), slowingLength) / (Sum(Highest(rainbow, length) - Lowest(rainbow, length), slowingLength) + 0.0001) * 100;
def normStochRainbow = 0.1 * (Stochastic - 50);
plot IFT = 100 / (1 + Exp(-2 * normStochRainbow));
plot OverBought = over_bought;
plot OverSold = over_sold;
Stochastic.SetDefaultColor(GetColor(1));
IFT.SetDefaultColor(GetColor(2));
OverBought.SetDefaultColor(GetColor(5));
OverSold.SetDefaultColor(GetColor(5));
#my code ------------------------------
plot down = if Stochastic >= IFT then IFT else Double.NaN;
down.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
```

The issue is that it seems to be working when the IFT and Stoch are above the overbought line but not when they're below that. No idea why that's happening. Any help would be appreciated.