Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Expert Advisor | Above Below MA

Idea by: Scriptor

MQL5 code author: barabashkakvn

How it works

The Expert Advisor uses the iMA (Moving Average, MA) indicator. It compares the open price of bar #0 and the Moving Average values on bars #0 and #1. If there is already an open position in the direction of the new signal, this signal will be ignored. The Expert Advisor performs operation on every tick.

Signals

  • BUY opening signal: bar #0 Open price is below MA #0 AND the ASK price is below MA #0 AND MA #1 is below MA #0.

  • SELL opening signal: bar #0 Open price is above MA #0 AND the BID price is above than MA #0 AND MA #1 is above MA #0.

A position is closed when an opposite signal occurs, i.e. a SELL position will be closed upon the emergence of a BUY signal.

MetaTrader Experts, Indicators, Scripts and Libraries

21733