Skip to content
All library documents

Alligator and RSI Rules for a Bar-Based Forex Trading EA

Article MQL5 code base

Summary

This expert advisor combines the Alligator indicator with RSI as a trend filter. It permits a buy when RSI crosses above 50 between the latest two bars and the Jaw, Teeth, and Lips lines each rise by more than a configurable delta. The sell conditions reverse those tests: RSI crosses below 50 and all three Alligator lines fall by more than the delta.

The EA checks entry signals when a new bar appears, uses a fixed lot size, calculates stop loss from the prior bar’s low or high plus an offset, and allows a fixed take profit and tick-by-tick trailing stop. An option closes positions opposite to a new signal. The accompanying optimization workflow first searches trailing and Alligator settings on USDJPY at a 15-minute interval, then checks the selected settings across symbols. No performance results or robustness evidence are reported, and the suggested optimization process does not establish that the strategy will generalize out of sample.

Key ideas

  • RSI crossing the 50 level filters Alligator-based entries for direction.
  • A buy requires all three Alligator lines to rise by more than the configured delta; a sell requires them all to fall by more than it.
  • The EA evaluates signals on new bars and can trail positions on each tick.
  • Position size is fixed, while stop loss uses the prior bar’s extreme and an offset.
  • The described optimization sequence tunes parameters on one forex pair and interval before evaluating other symbols, but reports no results.

Tags

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