An intersection of two Moving Averages based on the data of two bars is searched for generating a signal:
The number of the current bar can be specified in Trade bar: either bar #0 or bar #1.
If Use MACD is set to true, the EA will also take into account the position of the main MACD line relative to zero (the Trade bar parameter).
If a signal is generated when there are no open positions, a position is opened and four hedging orders are placed at a distance of Hedge level and the lifetime equal to Expiration pending orders: Buy Stop orders are placed in case of a BUY position; Sell Stop orders are placed in case of a SELL position.
Positions can be closed by an opposite signal if Close the opposite positions parameter is set to true. For example, SELL positions will be closed if a BUY signal is generated.
Once positions are opened, Trailing Stop with Trailing Step will be enabled for them.
Example of testing EURUSD, M30:
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/19945
A trading system based on two indicators: iSAR (Parabolic SAR) and iRSI (Relative Strength Index, RSI). Lot calculation based on the risk value as a percentage of free margin.Ambush
The Expert Advisor uses Buy Stop and Sell Stop orders to trade news and large price movements.
The indicator searches for divergences and displays them on the chart of the custom AO indicator.Trend Me Leave Me
The EA trades using the signals of iADX (Average Directional Movement Index, ADX) and iSAR (Parabolic SAR) indicators. The profit/loss of the last closed position is taken into account. Positions are moved to breakeven.