TradingView indicator guide

AlphaTrend on TradingView: volume and no-volume modes

AlphaTrend is an indicator by Kıvanç Özbilgiç, published as KivancOzbilgic on TradingView. This guide uses his open-source AlphaTrend publication o50NYLAZ, revision 3.0 dated May 20, 2022, written in Pine Script v5. It selects a trailing-line update with MFI by default or RSI when the no-volume option is enabled. Its signals compare that line with its value two bars earlier. Pineify did not create AlphaTrend.

See the decision guide

Select the original publication and the correct mode

Search TradingView Indicators for AlphaTrend and check the author KivancOzbilgic against the original source linked below. The separate AlphaTrend Strategy and AlphaTrend Screener publications have different jobs. Record the publication, revision, symbol, feed, chart timeframe and input settings before comparing another implementation.

  • Changing Source affects the RSI branch; the original MFI branch explicitly uses typical price. Matching the visible period alone does not establish matching inputs.
  • Check the actual volume series on the selected feed. Missing volume, zero volume and tick volume are different inputs. RSI mode removes the volume dependency but can produce different line values even where volume exists.
  • MFI or RSI equal to 50 selects the upward branch. Missing oscillator values during warm-up are not evidence of a bearish market.
SettingDefault volume modeNo-volume mode
Change calculation optionUncheckedChecked
Momentum inputMFI of typical price (high + low + close)/3 and volumeRSI of the Source input, which defaults to close
Upward update branchMFI is at least 50RSI is at least 50
Downward update branchValid MFI is below 50Valid RSI is below 50
Shared inputsCommon Period and MultiplierThe same Common Period and Multiplier

Reproduce the trailing-line calculation

Let n be Common Period, k be Multiplier, V be the simple average of the latest n true-range observations, and P be the previous AlphaTrend line. True range is max(high − low, |high − previous close|, |low − previous close|). The source names V as ATR, but it uses an SMA of true range, not the Wilder smoothing of the usual Pine ATR function.

  • The upward branch cannot lower the previous line; the downward branch cannot raise it. A momentum branch change can leave the line unchanged when neither candidate moves past P.
  • Initialization matters: the original source replaces an unavailable previous AlphaTrend value with zero. Do not seed a replica with the first close and expect identical early values. Wait for valid oscillator and range values and enough historical line values before judging signals.
  • For a clean comparison use a positive period and multiplier, standard candles and a fixed chart timeframe. A different smoothing method, synthetic candle input or additional timeframe request defines another variant.
StageCalculation after valid inputs are available
Lower candidate Llow − k × V
Upper candidate Uhigh + k × V
Selected oscillator ≥ 50Current AlphaTrend A = max(L, P)
Selected oscillator < 50Current AlphaTrend A = min(U, P)
Second plotted lineAlphaTrend from two bars earlier, A[t−2]

Check a case where the modes disagree

This hypothetical checkpoint supplies already-calculated momentum and range values; it is not a reconstruction of their full lookback windows. Set high = 105, low = 101, V = 2, k = 1 and previous line P = 98. Then L = 99 and U = 107. Assume the three preceding AlphaTrend values were all 98 in both modes.

  • This isolates the mode switch. The result says nothing about which mode earns more, and a raw crossing still has to pass the original label filter.
  • Hold the same high, low and V but change P to 103: both branches return 103. Different MFI and RSI readings therefore need not produce a different line on every bar.
Mode and supplied oscillatorBranchCurrent lineRaw upward crossing
Volume mode: MFI = 55Upwardmax(99, 98) = 99Yes: 99 > 98; previous comparison was equal
No-volume mode: RSI = 45Downwardmin(107, 98) = 98No: current comparison is equal
Boundary: selected oscillator = 50Upward99Yes under the same supplied history

Separate raw crossings from filtered labels

A raw upward crossing at t requires A[t] > A[t−2] and A[t−1] ≤ A[t−3]. A raw downward crossing reverses those inequalities. Equality on the current bar is not a crossing. The source also counts bars since past raw crossings before allowing a BUY or SELL label or a potential alarm.

  • For a BUY, compare bars since the one-bar-shifted raw BUY event with bars since the raw SELL event; the first count must be strictly greater. SELL uses the symmetric test. These counts use raw events, including crossings that did not display a label.
  • The Show Signals option controls labels. The potential alert conditions do not include that option, so hiding labels does not disable an existing alert.
  • A label can be absent before the required historical events exist, or when the count comparison is equal. Do not replace this rule with a vague instruction to alternate buys and sells.
BarA[t]A[t−2]Raw crossingFiltered label / potential condition
A (t = 0)101100BUYBUY
B101100NoneNone
C101101NoneNone
D102101BUYSuppressed
E102101NoneNone
F100102SELLSELL
G99102NoneNone
H99100NoneNone
I10099BUYBUY

Audit the signal table and confirmation delay

The table is a hypothetical signal-layer fixture with supplied line values, not OHLC market data. At t = −3, −2 and −1 the line is 100. Before A, assume the most recent raw BUY was at t = −8 and raw SELL at t = −5. Show Signals is enabled and all table values are completed-bar observations. These seeds make the historical count filters reproducible.

  • At A, the shifted BUY event last occurred at −7, so its age is 7; the last SELL age is 5. The BUY filter passes because 7 > 5.
  • At D, the shifted A BUY occurred at t = 1, giving age 2; the last SELL is now 8 bars old. The repeated raw BUY fails because 2 is not greater than 8.
  • At F, the shifted previous SELL age is 9 and the most recent raw BUY at D has age 2, so SELL passes. At I, the shifted D BUY age is 4 and the F SELL age is 3, so BUY passes.
  • The original Confirmed BUY Alarm checks the previous raw BUY and the previous shifted-BUY count against the current SELL count. For the A signal, that condition passes on B: 7 > 6. The suppressed D signal remains suppressed on E. The F SELL confirmation passes on G.
  • A once-per-bar alert can observe the prior-bar confirmation on the next bar update. Selecting Once Per Bar Close evaluates it at that next bar close. A custom rule that confirms the current crossing at the current close has different timing from this published revision.

Account for lag, failed signals and different trend indicators

The two-bar reference is historical comparison data, not a requirement to wait two full bars after every price turn. Response also depends on the oscillator window, range average, retained line and alert policy. A flat line can delay a crossing, and repeated crossings during a range can fail as trade entries.

  • A potential crossing can disappear before the live bar closes because price, volume and the calculated line are still changing. A closed historical marker does not show every temporary intrabar signal.
  • The original confirmed alarm still combines previous and current event counts. Compare the selected alert condition and frequency, not just the label color. Recreate TradingView alerts after changing inputs because running alerts retain a snapshot of their script and settings.
  • AlphaTrend is derived from Trend Magic. HalfTrend is a separate named implementation, including the public version by everget. Supertrend uses its own ATR bands and price-based direction rules. Similar trailing lines do not make these algorithms interchangeable.
  • An indicator level is not a broker stop order. Gaps, spread, slippage and transaction costs can change trade outcomes; a crossing alone supplies no position size or exit policy.

Specify an AlphaTrend inspection task for Pineify

The Pine Script AI Coding Agent can draft or revise a script from a written specification and provides a syntax-checking tool. Give it the public author reference, SMA-of-true-range formula, mode input and zero fallback for prior state. Request diagnostic outputs before adding trading orders or alerts.

  • Ask for both mode calculations and a comparison of current line, two-bar reference, raw crossings and historical event counts. Use the checkpoint and signal table here as separate acceptance cases.
  • Choose explicitly between reproducing revision 3.0 alerts and implementing a new current-bar close-confirmation policy. Retain attribution and comply with the original Mozilla Public License 2.0 and TradingView publication rules when reusing source.
  • After checking syntax, compare actual TradingView values on the same symbol, timeframe, session, inputs and loaded history. Only then create the intended alert. This page does not claim that a generated replica has been tested against live chart data or that private source can be reproduced.
Where Pineify fits

Pine Script AI Coding Agent

Draft an inspectable AlphaTrend calculation with declared initialization, mode selection and alert timing, then review its syntax and compare TradingView values.

Specify an AlphaTrend script

Frequently asked questions

Educational information, not investment advice. Numerical examples are hypothetical calculation checks, not backtests or live results. Indicator signals and syntax checks do not establish profitable trading rules.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.