Supertrend Indicator with Trend Color Change
Supertrend is a popular trend-following tool that works as a trailing stop. It builds two bands around the price at a distance of multiplier x ATR and follows only one of them at a time: the lower band in an up-trend and the upper band in a down-trend. A band can move only in the direction of the trend, so the line trails the price and does not step back.
When the close crosses the active line, the trend is considered changed: the indicator switches to the opposite band, the line jumps to the other side of the price and its color changes. Because the distance depends on ATR, the indicator adapts to volatility.
The ATR (Wilder smoothing) is calculated inside the indicator, so no indicator handles are needed. On each tick only the last bar is recalculated, and the whole history is processed only once.
Supertrend works best in trending markets. In a sideways market it can change direction often and produce false signals, so it is best used with a higher-timeframe filter or other confirmation.
| Input | Default | Purpose |
|---|---|---|
| Supertrend | ||
| InpAtrPeriod | 10 | ATR period (1 and above) |
| InpMultiplier | 3.0 | ATR multiplier; a larger value gives wider bands and fewer signals (greater than 0) |
| InpPriceSource | ST_SRC_MEDIAN | Price used as the center of the bands: ST_SRC_MEDIAN (High+Low)/2 or ST_SRC_CLOSE |
| Appearance | ||
| InpUpColor | clrWhite | Color of the line in an up-trend |
| InpDownColor | clrGray | Color of the line in a down-trend |
| InpUpStyle | STYLE_SOLID | Line style in an up-trend |
| InpDownStyle | STYLE_DASH | Line style in a down-trend |
| InpLineWidth | 1 | Line width (1 to 5). Dash and dot styles are drawn only with width 1 |
| Signals | ||
| InpShowArrows | true | Show arrows when the trend changes |
| InpBuyColor | clrWhite | Color of the buy arrow |
| InpSellColor | clrSilver | Color of the sell arrow |
| InpAlerts | false | Show an alert when a closed bar changes the trend |
| Info label | ||
| InpShowInfo | true | Show the info label with the current trend |
| InpInfoColor | clrWhite | Color of the info label |

Fig. 1. SupertrendColor on an H1 chart with default settings (black and white image per Code Base guidelines).
Candle Countdown Timer and Spread Display on Chart
Shows the time left until the current candle closes and the current spread in a corner of the chart. The countdown updates every second, even when no new ticks arrive.
ATR Dynamic Support and Resistance Bands
Dynamic support and resistance bands built from a moving average and the Average True Range (ATR). The bands widen when volatility rises and narrow when it falls.
Daily Open Line with Distance in Points
Draws the daily open price as a horizontal line and shows, in points, how far the current price is from today's open. The label changes color depending on whether the price is above or below the open.
MACD Signals
Indicator edition for new platform.