OPEN-SOURCE SCRIPT

[TehThomas] - MA Cross with Displacement

123
This TradingView script, "MA Cross with Displacement," is designed to detect potential long and short trade opportunities based on moving average (MA) crossovers combined with price displacement confirmation. The script utilizes two simple moving averages (SMA) and highlights potential trade signals when a crossover occurs alongside a strong price movement (displacement).

Why This Indicator is Useful
This indicator enhances the standard moving average crossover strategy by incorporating a displacement condition, making trade signals more reliable. Many traders rely on moving average crossovers to determine trend reversals, but false signals often occur due to minor price fluctuations. By requiring a significant price movement (displacement), this indicator helps filter out weak or insignificant crossovers, leading to more high-probability trade opportunities.

How It Works
Calculates Two Moving Averages (MA)
  • The user can set two different MA periods:
  • MA 1 (blue line): Default period is 9 (shorter-term trend).
  • MA 2 (red line): Default period is 21 (longer-term trend).
  • These moving averages smooth out price fluctuations to identify overall trends.

Detects Crossovers
Bullish crossover: The blue MA crosses above the red MA + displacement candle → Potential long signal.

Example of bullish cross with displacement:
syot kilat

Bearish crossover: The blue MA crosses below the red MA + displacement candle → Potential short signal.

Example of bearish cross with displacement:
syot kilat

Confirms Displacement (Strong Price Move)
  • A price displacement threshold is used (default: 1.1% of the previous candle size).
  • For a valid trade signal, a crossover must occur alongside a strong price movement.
  • Bullish Displacement Condition: Price increased by more than the threshold.
  • Bearish Displacement Condition: Price decreased by more than the threshold.

Visual Indicators on the Chart
  • Bars are colored green when there is a bullish displacement.
  • Bars are colored red when there is a bearish displacement.
  • These color changes help traders quickly identify potential trade setups.


How to Use the Indicator

Add the Script to Your Chart
  • Copy and paste the script into TradingView's Pine Script Editor.
  • Click "Add to Chart" to activate it.

Customize the Settings
  • Adjust the moving average periods to fit your trading strategy.
  • Modify the displacement threshold based on market volatility.
  • Change the bar colors for better visualization.

Look for Trade Signals
Long Trade (Buy Signal)
  • The blue MA crosses above the red MA (bullish crossover).
  • A green bar appears, confirming bullish displacement.

Short Trade (Sell Signal)
  • The blue MA crosses below the red MA (bearish crossover).
  • A red bar appears, confirming bearish displacement.

Use in Conjunction with Other Indicators
This indicator works best when combined with support & resistance levels, RSI, MACD, or volume analysis to improve trade accuracy.

Final Thoughts
The MA Cross with Displacement Indicator improves the reliability of moving average crossovers by requiring strong price movements to confirm a trade signal. This helps traders avoid false breakouts and weak trends, making it a powerful tool for identifying high-probability trades.

__________________________________________

Thanks for your support!
If you found this idea helpful or learned something new, drop a like 👍 and leave a comment—I’d love to hear your thoughts! 🚀

Make sure to follow me for more price action insights, free indicators, and trading strategies. Let’s grow and trade smarter together! 📈✨

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.