These four don't fit the average-or-oscillator mold. VWAP tracks the volume-weighted fair price and can reset on a calendar anchor. Ichimoku bundles five trend components. Supertrend is an ATR trailing stop that knows which side of the market it's on. PSAR is a parabolic stop-and-reverse dot. Each has a behavior worth understanding before you wire it up.
vwap
vwap(anchor?) — Volume-Weighted Average Price. The running average price weighted by volume.
| Parameter | Type | Description |
|---|---|---|
anchor | string | Reset boundary: "day", "week", or "month". Omit for a cumulative VWAP that never resets. |
With no anchor, VWAP accumulates from the first loaded bar and is finite immediately. With an anchor, it resets at each calendar boundary, so it answers "what's the average price this session / week / month."
The data-window catch. Anchored VWAP needs enough loaded bars to actually cross its anchor boundary, and it stays na in the leading partial period before the first reset. Daily anchoring becomes finite within the first day of data. Weekly needs roughly a week loaded. Monthly needs about a month of bars loaded before it shows any value at all — on a short window the monthly line is entirely blank, not because of a bug but because no month boundary has been crossed yet. If a monthly VWAP looks empty, load more history.
This is a data-window property, not a var-vs-timeseries rule. You can assign anchored VWAP to a var; the line fills in once the loaded window reaches the anchor boundary.
var cumulative = vwap() // finite from the first bar
var session = vwap(anchor="day") // resets each day; na before the first reset
var monthly = vwap(anchor="month")// needs ~a month of bars loaded to show valuesichimoku
ichimoku(source, conversionPeriod?, basePeriod?, laggingSpanPeriod?, displacement?) — Ichimoku Cloud.
| Parameter | Type | Description |
|---|---|---|
source | TimeSeries | OHLC series |
conversionPeriod | number | Tenkan-sen period (default 9) |
basePeriod | number | Kijun-sen period (default 26) |
laggingSpanPeriod | number | Senkou Span B period (default 52) |
displacement | number | Cloud displacement (default 26) |
Returns five streams [Tenkan, Kijun, Senkou A, Senkou B, Chikou]. Senkou A and B form the cloud; price above the cloud is bullish, below is bearish. Warmup is governed by the longest period (laggingSpanPeriod) plus the displacement.
var cloud = ichimoku(source=trade, conversionPeriod=9, basePeriod=26, laggingSpanPeriod=52, displacement=26)
plotLine(value=cloud, colors=["#0891b2", "#be123c", "#0f766e", "#b45309", "#64748b"], width=1, label=["Ichimoku"], desc=["Tenkan, Kijun, Senkou A, Senkou B, Chikou"])supertrend
supertrend(factor?, atrPeriod?) — ATR trailing stop with a direction stream.
| Parameter | Type | Description |
|---|---|---|
factor | number | ATR band multiplier (default 3) |
atrPeriod | number | ATR lookback (default 10) |
Returns the stop as .line and the regime as .direction (1 while long, -1 while short). The stop trails below price in an uptrend and above it in a downtrend; a flip in .direction is the signal. Reads OHLC implicitly, so pass no source. Warmup is about atrPeriod bars.
//@version=2
var st = supertrend(factor=3, atrPeriod=10)
plotLine(st.line, colorIndex=st.direction > 0 ? 0 : 1, colors=["#16a34a", "#dc2626"], width=2, label=["SuperTrend"], desc=["ATR trailing stop"])psar
psar(source, start?, increment?, maxValue?) — Parabolic SAR, a stop-and-reverse dot.
| Parameter | Type | Description |
|---|---|---|
source | TimeSeries | OHLC series |
start | number | Initial acceleration factor (default 0.02) |
increment | number | Acceleration step per new extreme (default 0.02) |
maxValue | number | Acceleration cap (default 0.2) |
Returns a single stream: the SAR price, which jumps to the other side of price when the trend flips. Lower acceleration gives smoother, less twitchy stops; higher reacts faster but whipsaws in ranges. Finite almost immediately.
var psarValue = psar(source=trade, start=0.02, increment=0.02, maxValue=0.2)Putting them together
All four on one panel. The VWAP variants show the anchor behavior side by side: the cumulative line starts at bar zero, while the anchored lines stay blank through their leading partial period and the monthly one needs a full month of loaded data before it appears.
//@version=2
define(title="Verified Special Indicators", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
var cumulativeVwap = vwap()
var dayVwap = vwap(anchor="day")
var weekVwap = vwap(anchor="week")
var monthVwap = vwap(anchor="month")
var cloud = ichimoku(source=trade, conversionPeriod=9, basePeriod=26, laggingSpanPeriod=52, displacement=26)
var trend = supertrend(factor=3, atrPeriod=10)
var psarValue = psar(source=trade, start=0.02, increment=0.02, maxValue=0.2)
plotLine(value=cumulativeVwap, colors=["#2563eb"], width=2, label=["VWAP"], desc=["cumulative vwap without anchor"])
plotLine(value=dayVwap, colors=["#16a34a"], width=2, label=["Day VWAP"], desc=["day anchored vwap"])
plotLine(value=weekVwap, colors=["#f97316"], width=2, label=["Week VWAP"], desc=["week anchored vwap"])
plotLine(value=monthVwap, colors=["#7c3aed"], width=2, label=["Month VWAP"], desc=["month anchored vwap"])
plotLine(value=cloud, colors=["#0891b2", "#be123c", "#0f766e", "#b45309", "#64748b"], width=1, label=["Ichimoku"], desc=["Ichimoku multi output"])
plotLine(value=trend, colors=["#111827", "#dc2626"], width=1, label=["Supertrend"], desc=["supertrend multi output"])
plotLine(value=psarValue, colors=["#9333ea"], width=2, label=["PSAR"], desc=["parabolic SAR"])Seeing the VWAP anchor boundary
If you want to watch exactly where each anchored VWAP turns on, plot a flag that is 1 while the value is still na. Each flag drops to 0 the moment its anchor boundary is crossed: day first, then week, then month. The cumulative line, by contrast, is never na.
//@version=2
define(title="VWAP Anchor Boundary", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
var dayLeading = isna(vwap(anchor="day")) ? 1 : 0
var weekLeading = isna(vwap(anchor="week")) ? 1 : 0
var monthLeading = isna(vwap(anchor="month")) ? 1 : 0
var cumulativeVwap = vwap()
plotLine(value=dayLeading, colors=["#16a34a"], width=2, label=["Day leading"], desc=["1 while day anchored vwap is na in the leading partial session"])
plotLine(value=weekLeading, colors=["#f97316"], width=2, label=["Week leading"], desc=["1 while week anchored vwap is na in the leading partial session"])
plotLine(value=monthLeading, colors=["#7c3aed"], width=2, label=["Month leading"], desc=["1 while month anchored vwap is na in the leading partial session"])
plotLine(value=cumulativeVwap, colors=["#2563eb"], width=2, label=["Cumulative VWAP"], desc=["no anchor vwap is cumulative from the first loaded bar"])