MACD Sample EA
EA Type: The MACD Sample EA is a Trend-Following and
Moving Average-based Expert Advisor. It uses the MACD indicator and an
Exponential Moving Average (EMA) to trigger buy and sell signals based on key
crossovers and levels.
Functionality and Strategy:
Lot Size Management: The lot size is adjustable, with a default of 0.1, allowing traders to scale risk according to their account size.
Key Indicators: This EA utilizes the MACD (Moving Average Convergence Divergence) and an Exponential Moving Average (EMA). The strategy is designed to identify trend changes by analyzing crossovers between the MACD line and the signal line, in conjunction with the EMA, generating trade signals based on these crossovers.
Opening Positions:
Buy Position: The EA opens a buy position when the current MACD value is negative but crosses above the signal line, while the EMA confirms an upward trend. Additionally, the MACD must exceed a configurable threshold (MACDOpenLevel) to validate the signal.
Sell Position: The EA opens a sell position when the current MACD value is positive but crosses below the signal line, and the EMA indicates a downward trend. Similar to buy signals, the MACD must surpass a predefined level for a valid sell signal.
Closing Positions: Positions are closed when the MACD behavior signals a reversal relative to the signal line and a specified threshold (MACDCloseLevel). A Trailing Stop is also used to lock in profits, adjusting the stop loss as the market moves in favor of the trade.
Risk Management:
Take Profit: The EA uses a preset Take Profit of 50 pips.
Trailing Stop: Configured at 30 pips, it dynamically adjusts the stop loss to secure gains as the market moves in favor of the trade.