This script plots a central line and top and bottom lines, like a bands.
If the market is up and price still going up then central line follow the last closed "close" value. If the market is up and price goes down, then central line stop change. If price still going down and cross bottom line, the direction changes and central line start to follow the close value if it is below central line.
I recommend to use Bandsize = 2 or 3 times ATR(300 or bigger)