已更新
[blackcat] L1 Vitali Apirine MAB

Level 1
Background
Vitali Apirine’s articles in the July & August issues on 2021, “Moving Average Bands”
Function
In “Moving Average Bands” (part 1, July 2021 issue) and “Moving Average Band Width” (part 2, August 2021 issue), author Vitali Apirine explains how moving average bands (MAB) can be used as a trend-following indicator by displaying the movement of a shorter-term moving average in relation to the movement of a longer-term moving average. The distance between the bands will widen as volatility increases and will narrow as volatility decreases.
Remarks
This is a Level 1 free and open source indicator.
Feedbacks are appreciated.
Background
Vitali Apirine’s articles in the July & August issues on 2021, “Moving Average Bands”
Function
In “Moving Average Bands” (part 1, July 2021 issue) and “Moving Average Band Width” (part 2, August 2021 issue), author Vitali Apirine explains how moving average bands (MAB) can be used as a trend-following indicator by displaying the movement of a shorter-term moving average in relation to the movement of a longer-term moving average. The distance between the bands will widen as volatility increases and will narrow as volatility decreases.
Remarks
This is a Level 1 free and open source indicator.
Feedbacks are appreciated.
發行說明
OVERVIEWThe [blackcat] L1 Vitali Apirine MAB indicator implements Vitali Apirine's Moving Average Bands (MAB) strategy, providing traders with a visual representation of price volatility and trend direction. This script calculates upper and lower bands around a mid-line Exponential Moving Average (EMA), generating buy and sell signals based on price interactions with these bands. It also includes alerts for various crossover events, enhancing decision-making processes 📊✅.
FEATURES
Calculates and plots Moving Average Bands:
Upper Band
Lower Band
Mid Line (Short-term EMA)
Long-term EMA
Visualizes band width and trend direction using colored fills between lines.
Generates buy and sell signals based on price crossovers with the bands 🚀📉
Adds visual labels for easy identification of trade signals:
"BUY" labeled in green when price crosses above the lower band.
"SELL" labeled in red when price crosses below the upper band.
Provides alert conditions for multiple crossover events 🔔
HOW TO USE
Add the indicator to your TradingView chart by selecting it from the indicators list.
Observe the plotted bands and EMAs for trends and volatility insights.
Monitor the buy ('BUY') and sell ('SELL') labels on the chart for potential trade opportunities.
Set up alerts based on the generated signals to receive notifications when conditions are met 📲.
Combine this indicator with other tools for confirmation before making trading decisions.
INPUT PARAMETERS
Short Period: Define the period for the short-term EMA (default is 50).
Long Period: Define the period for the long-term EMA (default is 10).
Multiplier: Adjust the bandwidth multiplier (default is 1.0).
LIMITATIONS
The indicator may generate false signals in highly volatile or ranging markets 🌪️.
Users should always confirm signals with other forms of analysis.
Optimal settings might vary depending on the asset and timeframe.
NOTES
Ensure that you have sufficient historical data available for accurate calculations.
Test the indicator thoroughly on demo accounts before applying it to live trading 🔍.
Experiment with different input parameters to find the best fit for your trading strategy.
發行說明
█ OVERVIEWblackcat L1 Vitali Apirine MAB turns the classic Moving Average Bands study into a complete trading toolkit: volatility-adaptive bands, state-gated BUY/SELL signals, ATR-based take-profit and stop-loss levels, and a live position dashboard. All signals confirm on bar close, so nothing repaints.
█ CONCEPTS
The indicator builds on Vitali Apirine's Moving Average Bands (2021):
• Band Basis: an EMA of the Short Period (default 50) forms the band center, the Mid Line
• Adaptive Deviation: the squared spread between this EMA and a faster EMA of the Long Period (default 10) is averaged, square-rooted, and scaled by the Multiplier to set band width
• The Upper and Lower Bands therefore expand and contract with trend volatility
• A signal engine adds a position state machine, cooldown, and entry/exit exclusivity on top of the raw band crosses
█ HOW TO USE
1 — Add the script to a candlestick chart; defaults work out of the box
2 — Tune the Moving Average Bands inputs to match your instrument's behavior
3 — Read signals: BUY when price closes back above the Lower Band, SELL when price closes back below the Upper Band
4 — Exit longs (XL) when price closes below the Mid Line; exit shorts (XS) when it closes above
5 — Use the plotted TP/SL lines as volatility-based trade management references
6 — Create alerts from any of the eight alert conditions in the alert dialog
Input Parameters
• Short Period (Band Basis EMA): center-line EMA length, default 50
• Long Period (Spread EMA): faster EMA used in the deviation calculation, default 10
• Multiplier: band width scale, default 1.0
• Enable Signal Engine: master switch for gated signals and labels
• Enable Short Signals: turn off for long-only trading
• Cooldown Bars: minimum bars between signals, default 3 (0 disables)
• Same-bar Entry/Exit Exclusivity: blocks entries that conflict with exits on the same bar
• Show TP/SL Levels, ATR Length, Stop Loss (xATR), Take Profit (xATR): ATR-based risk levels, defaults 14 / 2.0 / 3.0
• Show Signal Labels, Show Position Background, Show Dashboard: visual toggles
█ FEATURES
• Non-repainting signals: every entry and exit confirms at bar close
• State-gated logic: no repeated same-direction signals; position flips handled cleanly
• ATR-based TP/SL: volatility-adaptive levels plotted while a trade is active
• Dashboard: position, trend direction, ATR, and entry/TP/SL prices at a glance
• Background shading and band coloring for instant trend reading
█ SIGNALS
Visual Elements
• BUY label (green, below bar): long entry confirmed at bar close
• SELL label (red, above bar): short entry confirmed at bar close
• XL / XS cross (orange): long / short exit at the Mid Line
• Green background: long active; red background: short active
• Upper Band (yellow) / Lower Band (fuchsia): volatility envelope; fill tracks band slope
• Mid Line (green) / Long Term EMA (red): trend pair; fill is green in uptrends, red in downtrends
• Data window: Position State (+1 long / 0 flat / -1 short)
█ IMPLEMENTATION NOTES
Open-source under MPL 2.0, written in Pine Script v6. Uses ta.ema, math.sum and math.sqrt for the band deviation, ta.atr for risk levels, and ta.crossover / ta.crossunder for triggers. The four raw band and EMA cross alert conditions from V1 are preserved unchanged; V2 adds close-confirmed state-gated alert conditions plus dynamic alerts using alert.freq_once_per_bar_close. Turning Enable Signal Engine off reproduces the plain V1 bands.
█ LIMITATIONS
• Band-reversion entries suit ranges and swing conditions; strong one-way trends can ride the band without reversion
• Cooldown and exclusivity reduce whipsaw but skip some fast repeated entries
• TP/SL levels are references for manual management; this is an indicator, not an auto-trading strategy
• Test on your symbol and timeframe before trusting defaults
█ NOTES
• Concept credit: Vitali Apirine, Moving Average Bands (Stock & Commodities, 2021)
• V1 by blackcat1402; V2 adds signal governance, risk levels, and a dashboard
• Mozilla Public License 2.0 — free to use and modify with attribution
════════════════════════════════════════════════════════════════════════
For questions or feedback, please use the comments section below.
Feel free to use and modify — attribution appreciated.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。