A DeMarker Expert Advisor Using Threshold Reversals
Summary
This example describes a single-symbol expert advisor that uses the DeMarker indicator to generate contrarian entries. It reads indicator values on a selected timeframe and sets a sell signal when the prior reading is above an upper threshold and the current reading crosses back below it. A buy signal is formed when a reading below the lower threshold crosses back above. The settings also expose trade size, stop loss, take profit, and a timeframe option; the example raises the requested size to the broker’s minimum if needed.
The shown order logic gates entries on a new bar and an entry flag, then submits market orders with stop-loss and take-profit prices. It tracks the ticket and resets the entry flag after the trade closes. The code leaves the active-trade closing condition unfinished and does not demonstrate a complete new-bar implementation, robust order-error handling, or testing results. Threshold reversals may fail in persistent trends, and the post offers no evidence that the example is profitable or safe to deploy unchanged.
Key ideas
- The EA sells after DeMarker retreats below an upper threshold and buys after it rises above a lower threshold.
- Indicator timeframe, period, thresholds, trade size, stop loss, and take profit are configurable.
- A new-bar and entry-state gate is intended to prevent repeated entries.
- The example adjusts requested trade size to the broker’s minimum volume.
- The active-trade exit condition is left unfinished, and no backtest results are provided.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.