Skip to content
All library documents

Stochastic-Pyramid Stock Buying with Trailing Stops and Loss Limits

Article MQL5 code base

Summary

The document describes an expert advisor for stocks priced below a chosen ceiling. It places an initial small buy when price rises above a stochastic low level, then adds equal-sized lots after declines. A percentage step setting controls when another buy may be placed, and a trailing stop is activated when price rises above the purchase price plus spread. Stochastic level crossings, price limits, a per-chart identifier, and timed profit-based closing are configurable.

The author favors stocks with low swap costs and explains that exposure can grow substantially as positions are added. The stated loss examples assume a stock falls to zero; losses may also occur if a broker stops supporting the stock. The document cautions about overnight gaps and recommends closing profitable open orders before market close. It provides no systematic performance evidence, and the strategy's averaging down can accumulate risk during sustained declines; the closing and stop settings do not establish a guaranteed maximum loss.

Key ideas

  • The system begins with a small buy after price rises above a stochastic low level.
  • It adds equal-sized lots after price declines, with a configurable percentage step between buys.
  • A trailing stop is activated after price exceeds the purchase price plus spread.
  • Price bounds and timed profit-based closing can restrict eligible trades and closing behavior.
  • Averaging down can build substantial exposure, and overnight gaps or broker delisting can cause losses.

Tags

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