EMA 40 Pullback Pyramid Strategy by ADXAE

By ADXAE

Performance Metrics

Description

OverviewEMA 40 Pullback Pyramid Strategy is a long-only trend-following strategy designed to identify bullish trend conditions using a 40-period Exponential Moving Average, ADX trend-strength filtering, ATR-based pullback re-entries, pyramiding, and optional EMA 40 cross-based buy and sell signals.The strategy is built to follow upward trends, enter when bullish momentum begins to develop, add positions during controlled pullbacks toward the EMA, and exit when the trend weakens or when price crosses below the EMA 40.This script is intended for research, backtesting, and educational use. It is not financial advice, investment advice, or a recommendation to buy or sell any financial instrument.Core LogicThe strategy combines four main components:1. EMA 40 trend direction2. ADX trend-strength confirmation3. ATR-based pullback re-entry logic4. Optional EMA 40 cross buy/sell signalsThe main idea is to trade in the direction of the EMA trend and use pullbacks toward the EMA as potential re-entry opportunities.How the Strategy Works1. EMA 40 Trend DirectionThe script calculates an Exponential Moving Average using the selected EMA length. The default value is 40.The EMA line changes color based on its slope:- Green: EMA is rising.- Red: EMA is falling.- Gray: EMA is flat or unchanged.A rising EMA indicates bullish trend conditions. A falling EMA indicates weakening or bearish conditions.2. Base EntryThe original base entry signal is generated when the EMA slope changes from non-rising to rising while ADX is above the selected threshold.This is designed to detect the early stage of a potential bullish trend shift.Base entry requirements:- EMA slope turns upward.- ADX is above the selected threshold.- The signal occurs within the selected date range.- The minimum number of bars between entries has passed.This signal appears on the chart as:BUY3. Pullback Re-EntryThe strategy includes a pullback re-entry system.A pullback condition is detected when price moves close to the EMA area. This area is calculated using ATR.The pullback zone is based on:EMA + ATR x Pullback MultiplierA recovery condition is detected when:- Price closes above the EMA.- Price closes above the candle open.When the broader trend remains valid and price recovers from the pullback zone, the strategy can generate an additional entry signal.This signal appears on the chart as:ADD4. EMA 40 Cross Buy/Sell SignalsThe strategy also includes optional EMA 40 cross signals.In Close mode:- Buy signal occurs when the closing price crosses above the EMA 40.- Sell signal occurs when the closing price crosses below the EMA 40.In Wick mode:- Buy signal occurs when price touches or moves below the EMA and then closes above it.- Sell signal occurs when price touches or moves above the EMA and then closes below it.Close mode usually provides cleaner and more confirmed signals. Wick mode is more sensitive and may generate more frequent signals.These signals appear on the chart as:Buy signalSell signal5. PyramidingThe strategy allows pyramiding up to 3 entries.The default position size is 33% of equity per entry. This allows the strategy to build exposure gradually instead of entering the full position at once.Pyramiding may occur from:- The original base entry- Pullback re-entry signals- EMA 40 cross buy signals, if enabled for strategy orders6. Exit LogicThe strategy can exit positions using two types of exit logic:Original EMA slope exit:- The EMA slope turns downward.EMA 40 cross exit:- Price crosses below the EMA 40.The EMA cross exit may react faster than the EMA slope exit, but it may also generate more exits in sideways or choppy markets.Inputs and SettingsStart DateDefines the beginning of the backtesting and trading period.End DateDefines the end of the backtesting and trading period.Fast EMA LengthDefault: 40Controls the EMA used for trend direction, pullback logic, and EMA cross signals.DI LengthDefault: 14Used in the DMI/ADX calculation.ADX SmoothingDefault: 14Controls the smoothing period used for ADX.ADX Minimum to TradeDefault: 20Used by the original base entry logic and trend filter. A higher value makes the strategy more selective. A lower value increases the number of possible signals but may also increase false signals.Enable Pullback Re-EntryTurns the pullback ADD logic on or off.Pullback Distance x ATRDefault: 1.0Controls how close price must come to the EMA area to qualify as a pullback.A lower value makes the pullback condition stricter.A higher value makes the pullback condition more flexible.ATR LengthDefault: 14Used to calculate the ATR-based pullback zone.Minimum Bars Between EntriesDefault: 5Prevents the strategy from entering too frequently by requiring a minimum number of bars between entries.Use EMA 40 Cross Buy/Sell SignalsEnables or disables EMA 40 cross-based visual buy and sell signals.EMA Cross Detection ModeOptions:- Close- WickClose mode waits for a confirmed close above or below the EMA.Wick mode detects intrabar interaction with the EMA and may generate more frequent signals.Use EMA Cross Signals in Strategy OrdersWhen enabled, EMA cross signals can trigger actual strategy orders.When disabled, EMA cross signals are shown visually only and do not affect strategy orders.Visual SignalsBUYOriginal base entry signal. It appears when the EMA slope turns upward and ADX confirms sufficient trend strength.ADDPullback re-entry signal. It appears when price pulls back toward the EMA area and then recovers while the trend remains valid.Buy signalEMA 40 cross buy signal. It appears when price crosses above the EMA 40 based on the selected detection mode.Sell signalEMA 40 cross sell signal. It appears when price crosses below the EMA 40 based on the selected detection mode.Original EMA slope sellThis is the original EMA slope-based sell signal. It is hidden by default in the style settings to reduce chart clutter, but the original exit logic remains part of the strategy.Strategy PropertiesInitial capital: 1000Position sizing: 33% of equity per entryPyramiding: 3Commission: 0.1%Slippage: 0Trade direction: Long onlyThe strategy does not open short positions.Important NotesThis strategy does not include a fixed stop loss, fixed take profit, or trailing stop by default.The exit logic is based on EMA slope behavior and/or EMA 40 cross behavior.Because there is no fixed stop loss, drawdowns can become significant during sharp reversals, gap-down moves, or choppy market conditions.The strategy is mainly designed for trending markets. It may perform poorly in sideways or range-bound markets where price repeatedly crosses above and below the EMA.Backtesting ConsiderationsBacktest results may vary significantly depending on:- Symbol- Timeframe- Market conditions- Date range- Commission- Slippage- EMA length- ADX threshold- ATR settings- Pullback multiplier- Minimum bars between entries- EMA cross detection mode- Whether EMA cross signals are enabled for strategy ordersUsers should test the strategy across multiple symbols, timeframes, and market environments before relying on any results.Limitations- Long-only strategy.- No fixed stop loss.- No fixed take profit.- No trailing stop.- EMA-based systems can lag during fast reversals.- EMA cross signals may create false signals in sideways markets.- ADX filtering can reduce weak entries but may also delay some valid entries.- Pyramiding increases exposure and can increase drawdown if the trend fails.- Results are sensitive to the selected timeframe and asset.Recommended UseThis script is best used as a research and backtesting tool for studying EMA 40 trend-following behavior, pullback re-entries, and EMA cross exits.Suggested starting settings:- EMA Length: 40- ADX Threshold: 20- ATR Length: 14- Pullback ATR Multiplier: 1.0- Minimum Bars Between Entries: 5- EMA Cross Detection Mode: Close- Use EMA Cross Signals in Strategy Orders: EnabledFor cleaner signals, use Close mode.For more sensitive signals, use Wick mode.Risk DisclaimerThis script is provided for educational and research purposes only.It is not financial advice, investment advice, or a recommendation to buy or sell any financial instrument.Trading involves risk. Past performance does not guarantee future results.Users are responsible for their own trading decisions, risk management, and interpretation of strategy results.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView