Skip to content
All library documents

Managing Forex Positions With Adjustable Trend Lines

Article MQL5 code base

Summary

The document describes an expert advisor for forex hedging accounts that draws a trend line when a new position appears. For a buy, the line starts below the opening price; for a sell, it starts above. It extends two bars into the future and shifts as new bars form, while remaining adjustable by the user.

If the line is moved past the relevant position price, the advisor sends a message stating the price and the combined profit or loss at which all positions would be closed. This is a position-management and alert mechanism rather than a demonstrated signal for entering trades. The note says the advisor has not been tested on netting accounts and offers no performance results, risk controls, or evidence that the line placement improves outcomes.

Key ideas

  • The advisor draws an adjustable trend line when a forex position opens.
  • Buy and sell positions receive lines on opposite sides of their opening prices.
  • The line extends ahead of the current bar and moves as new bars appear.
  • Moving the line across the position price triggers a message about closing all positions and their resulting profit or loss.
  • The advisor is intended for hedging accounts and has not been tested on netting accounts.

Tags

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