OPEN-SOURCE SCRIPT
Atualizado SMA DMA Crossing Signal

SMA and DMA Crossing Buy Sell Signals
This script implements a Double Moving Average (DMA) strategy, a popular technical analysis technique used by traders to identify trends and potential buy/sell signals in financial markets.
**Description:**
The Double Moving Average strategy involves the calculation of two moving averages – a short-term moving average and a long-term moving average. In this script, we calculate these moving averages as follows:
1. **Short-term DMA (`dmaShort`):**
- Calculated using a 28-bar Simple Moving Average (SMA).
- Represents the shorter-term trend in the price movement.
2. **Long-term DMA (`dmaLong`):**
- Also calculated using a 28-bar SMA.
- Displaced backward by 14 bars (`dmaLong := request.security(syminfo.tickerid, "D", dmaLong[14])`), effectively creating a 28-bar SMA with a -14 bar displacement.
- Represents the longer-term trend in the price movement.
**Signals:**
Buy and sell signals are generated based on the crossing of the short-term DMA over or under the long-term DMA:
- **Buy Signal (`DMA BUY`):** Occurs when the short-term DMA crosses above the long-term DMA (`dmaBuySignal`).
- **Sell Signal (`DMA SELL`):** Occurs when the short-term DMA crosses below the long-term DMA (`dmaSellSignal`).
**How to Use:**
- **Buy Signal:** Consider entering a long position when the short-term DMA crosses above the long-term DMA, indicating a potential uptrend.
- **Sell Signal:** Consider exiting a long position or entering a short position when the short-term DMA crosses below the long-term DMA, indicating a potential downtrend.
This script provides a visual representation of the DMA crossover signals on the chart, helping traders identify potential entry and exit points in the market.
**Note:** It's important to combine DMA signals with other technical analysis tools and risk management strategies for informed trading decisions.
All comments are welcome..
This script implements a Double Moving Average (DMA) strategy, a popular technical analysis technique used by traders to identify trends and potential buy/sell signals in financial markets.
**Description:**
The Double Moving Average strategy involves the calculation of two moving averages – a short-term moving average and a long-term moving average. In this script, we calculate these moving averages as follows:
1. **Short-term DMA (`dmaShort`):**
- Calculated using a 28-bar Simple Moving Average (SMA).
- Represents the shorter-term trend in the price movement.
2. **Long-term DMA (`dmaLong`):**
- Also calculated using a 28-bar SMA.
- Displaced backward by 14 bars (`dmaLong := request.security(syminfo.tickerid, "D", dmaLong[14])`), effectively creating a 28-bar SMA with a -14 bar displacement.
- Represents the longer-term trend in the price movement.
**Signals:**
Buy and sell signals are generated based on the crossing of the short-term DMA over or under the long-term DMA:
- **Buy Signal (`DMA BUY`):** Occurs when the short-term DMA crosses above the long-term DMA (`dmaBuySignal`).
- **Sell Signal (`DMA SELL`):** Occurs when the short-term DMA crosses below the long-term DMA (`dmaSellSignal`).
**How to Use:**
- **Buy Signal:** Consider entering a long position when the short-term DMA crosses above the long-term DMA, indicating a potential uptrend.
- **Sell Signal:** Consider exiting a long position or entering a short position when the short-term DMA crosses below the long-term DMA, indicating a potential downtrend.
This script provides a visual representation of the DMA crossover signals on the chart, helping traders identify potential entry and exit points in the market.
**Note:** It's important to combine DMA signals with other technical analysis tools and risk management strategies for informed trading decisions.
All comments are welcome..
Notas de Lançamento
Double Moving Average Crossings IndicatorOverview
The Double Moving Average (DMA) Crossings indicator is a powerful tool designed to help traders identify potential buy and sell signals based on the crossover of two moving averages with different displacements. This indicator combines short and long Double Moving Averages (DMA) along with traditional Simple Moving Averages (SMA) to provide a comprehensive view of market trends and potential reversal points.
Key Features
DMA Short and Long: The indicator calculates two DMAs with the same period but different displacements, providing a more dynamic view of the market.
DMA Short: Plotted in fuchsia color with a circle style line for better visibility.
DMA Long: Plotted in aqua color with a cross style line to distinguish from the short DMA.
Simple Moving Averages:
SMA 30: Plotted in yellow, representing the short-term trend.
SMA 50: Plotted in blue, indicating the intermediate trend.
SMA 200: Plotted in green, showing the long-term trend.
Buy and Sell Signals:
Buy Signal: Generated when the short DMA crosses above the long DMA, indicated by a green upward arrow below the bar.
Sell Signal: Generated when the short DMA crosses below the long DMA, shown by a red downward arrow above the bar.
Usage
This indicator is suitable for traders looking for clear and actionable signals in the market. The combination of DMAs and SMAs allows traders to:
Identify potential entry and exit points based on DMA crossovers.
Observe short-term, intermediate, and long-term trends with SMAs.
Make informed trading decisions with the help of visual buy and sell signals.
How to Interpret
Buy Signal: A green arrow below a bar indicates a potential buying opportunity. This occurs when the short DMA (fuchsia) crosses above the long DMA (aqua).
Sell Signal: A red arrow above a bar signals a potential selling point. This happens when the short DMA (fuchsia) crosses below the long DMA (aqua).
Trend Analysis: The SMAs provide additional context for trend direction:
SMA 30 (yellow) shows the short-term trend.
SMA 50 (blue) reflects the intermediate trend.
SMA 200 (green) represents the long-term trend.
When SMA 30 crosses over the SMA 50 it is bullish and When it crosses below it is bearish trend
Conclusion
The Double Moving Average Crossings indicator is a versatile tool for traders seeking to enhance their market analysis with reliable trend and crossover signals. By combining DMAs and SMAs, this indicator offers a comprehensive view of market dynamics, making it easier to identify profitable trading opportunities.
Notas de Lançamento
Update: Swapped the DMA Short and DMA Long ColorsNotas de Lançamento
SMA DMA Crossing SignalA powerful hybrid trend-and-momentum indicator combining Simple Moving Averages (SMA) with a Double Moving Average (DMA) crossover system.
This tool helps traders visualize market structure, trend strength, and momentum shifts all in one clean overlay — perfect for swing trading, stage analysis, and early trend detection.
🔍 What This Indicator Does
1. Trend Structure with SMAs (30, 50, 200)
The indicator plots:
SMA-30 — short-term trend
SMA-50 — medium-term confirmation
SMA-200 — long-term primary trend
These SMAs make it easy to identify:
Stage 1 — Consolidation
Stage 2 — Breakout & Uptrend
Stage 3 — Distribution / Topping
Stage 4 — Breakdown & Downtrend
Golden Cross & Death Cross dynamics
Trend slope & strength
2. DMA Momentum Engine (Fast vs Higher-Timeframe Slow DMA)
The heart of this indicator is the customizable Double Moving Average system:
Fast DMA: reacts quickly on the current timeframe
Slow DMA: derived from a user-selectable higher timeframe (default: Daily)
You may also shift the slow DMA for smoother trend confirmation.
This dual-DMA setup delivers:
✔ Faster signals than standard MA crossovers
✔ Fewer whipsaws
✔ Momentum confirmation from a higher timeframe
✔ Reliable trend continuation & reversal identification
3. Automatic BUY / SELL Signals
Buy and Sell signals trigger when:
📈 BUY → Fast DMA crosses above Slow DMA
📉 SELL → Fast DMA crosses below Slow DMA
Arrows are plotted directly on the chart:
BUY arrows appear below bars
SELL arrows appear above bars
Simple, visually clean, and ideal for signal scanning.
4. Built-in Alerts (Perfect for Automation)
Use TradingView’s alerts for:
SMA DMA Crossing Signal – BUY
SMA DMA Crossing Signal – SELL
Great for:
Live trading
Discord/Telegram alerts
Bot integrations
Swing/position trade monitoring
🎯 Who Should Use This Indicator
This indicator is built for traders who want trend clarity + early entries:
Swing traders
Trend followers
Momentum & breakout traders
ETF traders (SOXL, TQQQ, SPXL, etc.)
Crypto & FX traders
Stage Analysis users
🧠 Why It Works
Most indicators show either:
Trend structure (SMA)
or
Momentum shift (EMA/MA crossovers)
This indicator combines both, letting you see:
Where the trend is going (SMAs)
When momentum flips (DMA crossovers)
The result:
Fewer false entries and clearer trend continuation signals.
⚠️ Disclaimer
This script is for educational use.
Always pair signals with risk management and independent analysis.
Notas de Lançamento
Updated SMAsScript de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.