Skip to content
All library documents

Combining Moving Averages, MACD, and CCI in a USDJPY Expert Advisor

Article MQL5 code base

Summary

This Expert Advisor example applies two moving averages, MACD, and the Commodity Channel Index to USDJPY on an hourly chart. It reads indicator values from completed bars, including consecutive MACD readings, and uses trade-transaction events to track position opening and closing times. The stated design also checks whether a position has already been opened on the current bar, helping avoid duplicate entries without scanning positions that may belong to other strategies.

The document focuses on implementation and trade-state handling rather than providing a complete description of the entry and exit rules. It includes excerpts showing how indicator values and deal history are processed, but reports no backtest, profitability, or risk results. The example’s behavior is specific to its symbol and timeframe, and its usefulness elsewhere would depend on the omitted signal logic and independent testing.

Key ideas

  • The example combines two moving averages with MACD and CCI for USDJPY on an hourly chart.
  • Indicator readings are taken from completed bars.
  • Trade-transaction events record deal activity and update position timing state.
  • The strategy checks for an existing entry on the current bar to reduce duplicate trades.
  • No performance or risk evidence is reported.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.