OPEN-SOURCE SCRIPT

Smart MA Crossover

227
█ OVERVIEW
"Smart MA Crossover" is a technical analysis indicator designed to enhance the effectiveness of strategies based on MA crossovers, combining classic moving average crossovers with breakouts from boxes and dynamic trend visualizations. The indicator is fully customizable—you can freely adjust both parameters and graphical elements.

█ CONCEPTS
Trading approaches based solely on moving average crossover moments generate a large number of false signals. Smart MA Crossover was created to improve this statistic. That's why boxes are added, which are formed from the candle where the MA crossover occurred and generate signals only upon breakout from them. The boxes have bullish (green) and bearish (red) colors. By default, the show_only_matching filter is enabled, displaying entry signals only when the breakout direction matches the box color (e.g., only upward for a bullish box). Boxes are by default the size of the candle on which the crossover occurred, but their size can be adjusted to suit your strategy via an optional average candle size multiplier.

█ FEATURES
- Moving Averages: Two configurable MAs (fast_length, default 10; slow_length, default 30) with selectable type (SMA, EMA, WMA, HMA, VWMA). Optionally displayed with gradient fill between them (color depends on trend: green for uptrend, red for downtrend).
- MA Gradient and Candle Coloring: Enable gradient fill between MAs (transparency: gradient_opacity, default 85) and dynamic candle coloring based on trend (green/red).
- Fog Gradient Trend: Multi-layered gradient "fog" around hl2, consisting of 5 levels up and down, with offset based on average candle size (offset_mult, default 0.7) and increasing transparency (base_transp, default 80; transp_inc, default 4). Fog colors are dynamic (green/red).
- Breakout Boxes: Created at the moment of MA crossover, extending to the right. Box height optionally multiplied by average candle size (use_box_multiplier, box_multiplier, default 1.0). Boxes close and generate a signal when price breaks out beyond the top/bottom edge.

Signals:
- Triangles: Green downward triangles (buy breakout) below the bar, red upward triangles (sell breakout) above the bar—only on breakouts matching direction (if show_only_matching = true). When the matching filter is disabled, every box generates a signal based not on the MA crossover, but on the breakout direction.
- Labels: “BUY” (green, below bar) and “SELL” (red, iabove bar) with transparent background (transparency 40).
- Matching Filter: The show_only_matching option limits signals to breakouts consistent with box direction (bullish box → only buy, bearish → only sell).

- Visualization: Gradient MA lines, fill between MAs, multi-layered fog with increasing transparency, boxes with transparent background (85) and colored borders, dynamic trend colors.
- Alerts: Built-in alerts for BUY and SELL signals (with message including ticker and timeframe).

█ HOW TO USE
Add to Chart: Apply the indicator via Pine Editor or the Indicators menu on TradingView.

Configure Settings:
- MA Settings: Adjust fast (fast_length, default 10) and slow (slow_length, default 30) MA lengths and type (ma_type, default SMA).
- Visualization: Enable/disable MA lines (show_ma_lines), MA gradient (use_gradient_ma), fog trend (show_fog), candle coloring (color_candles).
- Boxes and Breakouts: Enable candle size multiplier (use_box_multiplier) and set value (box_multiplier, default 1.0). Enable signal filter (show_only_matching).
- Signals: Choose type (signal_type): Triangles or Labels (Buy/Sell).
- Fog Trend: Adjust offset (offset_mult), base transparency (base_transp), and increment (transp_inc). Select trend colors (col_up, col_dn).

Signal Interpretation:
- Buy Signals: Green triangles below the bar or “BUY” label—on upward breakout from a bullish box (after bull cross).
- Sell Signals: Red triangles above the bar or “SELL” label—on downward breakout from a bearish box (after bear cross).
- Fog and Gradient: green fog/fill = uptrend; red = downtrend.
- Boxes: Active boxes indicate potential breakout zones; their closure confirms the move.

Signal Confirmation: Use with other tools, such as support/resistance levels, volume, or additional MAs to filter false crossovers.

█ APPLICATIONS
- MA Cross Strategies: Replace classic crossovers—boxes and breakouts eliminate many false signals, thereby increasing effectiveness. Confirm with other indicators, e.g., RSI, Fibonacci, FVG, pivot levels.
- Trend Following: Can be used as a classic trend indicator, especially with larger MA values.

█ NOTES
- Test the indicator across different timeframes and assets, adjusting MA lengths and box multiplier to market volatility.
- In consolidating markets, the indicator generates more false signals.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.