Sma trends
Two lines a fixed percent above and below a moving average, not real support and resistance.
Takes the simple moving average of the close over the window, then draws one line a set percentage (2% by default) below it and one the same percentage above. Despite the support and resistance name, the lines come from the average alone, not from recent lows or highs, so they never widen or narrow with volatility. The two pane outputs show how much the average itself changed over the window, in percent.
How to read it
- The two price lines sit about 2% either side of a moving average of the close; price between them is near its recent average.
- Price beyond a line means it moved more than the band away from that average, not that it touched a recent low or high.
- The pane below shows the average's slope in percent: 0 is flat, and readings inside the shaded zones are the steepest 10% of bars.
What it outputs
- Lower band
- The average close minus band_pct, about 2% under it by default. Price drops below it when it falls more than that below its average.
- Upper band
- The average close plus band_pct, about 2% over it by default. Price rises above it when it runs more than that above its average.
- Average slope
- How far the average moved over the window, in percent: 0.19 means it rose 0.19%. Above zero is rising, below zero falling.
- Slope (duplicate)
- Identical to Average slope: the code returns the same slope twice, so this line repeats it.
Settings
- window
- How many bars the average looks back over; the default 50 is 50 minutes. Shorter (about 10 to 20) makes the bands hug price and the slope swing fast; longer (200 and up) gives slow lines that price crosses only on sustained moves.
- band_pct
- Distance of each band from the average (0.02 = 2%). Raising it widens both lines, so price needs a bigger move to reach them; lowering it pulls them onto the average. Negative values swap the lines; above 1 the lower one goes below zero.
Pitfalls
- The name says support and resistance, but the lines are just the average plus or minus a fixed percent; they ignore actual highs and lows and do not widen in volatile markets.
- The two slope outputs are the same series, because the code returns one slope twice. Read either one and ignore the other.
- Slope is a percent change over the window, so most readings are small: 90% of bars sit between -0.19 and +0.19. Nothing is drawn for the first window bars while the average fills.