OPEN-SOURCE SCRIPT

EMA Grid + Martingale Indicator (Long-Only)

186
Title:
EMA Grid + Martingale Indicator (Long-Only)

Short Summary:
A 4-EMA trend filter combined with a grid-based entry system and optional martingale sizing to visualize staged long entries and exits in bullish markets.

Full Description:
This indicator combines a 4-EMA trend filter with a grid-based entry system and optional martingale-style position sizing to help traders visualize staged long entries and exits in trending markets.

How It Works
1. Trend Detection: Uses two sets of EMAs (fast/slow pairs) to confirm bullish momentum. A long signal is generated when both EMA groups align in an uptrend.
2. Grid Entries: After the initial long entry, additional grid levels are triggered every time price drops by the specified grid step (in pips).
3. Martingale Sizing (Optional): Each subsequent entry can increase in size based on the defined martingale factor.
4. Weighted-Average Exit: Calculates the weighted average of all grid entries and signals an exit when the price reaches or surpasses this level plus an optional buffer.

Key Features
• 4 EMA Trend Filter with fully customizable lengths.
• Dynamic grid entries with visual labels (L1, L2, etc.).
• Optional martingale position sizing.
• Weighted-average exit with adjustable buffer.
• Customizable parameters for EMAs, grid steps, max entries, and buffer pips.
• Clear chart visualization of EMAs and entry/exit levels.

Use Cases
• For traders using cost-averaging or grid strategies in bullish markets.
• Visualizes multiple entry levels and profit targets.
• Useful for backtesting and strategy planning.

Note: This indicator is for visualization and planning purposes only. It does not execute trades automatically. It does not guarantee profits and is not financial advice.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.