Skip to content
All library documents

Managing Equal Long and Short Positions with a Positive Lock

Article MQL5 code base

Summary

The document describes a trading robot that opens equal-volume long and short positions in the same asset, creating a lock whose opposing price exposure offsets at the position level. It then outlines ways to manage that locked position: average into both sides, close the pair and restart, close one side to let the other run, apply trailing stops, or move one side to breakeven. Separate cycles can be run on other instruments or under distinct identifiers.

The document offers an operational outline rather than performance evidence, entry rules, or a tested exit method. A lock does not remove trading costs or the need to choose which side to retain. It can incur commissions on both positions, possible negative rollover on one side in forex, and continued use of margin. The method therefore shifts the decision from initial direction selection to managing the positions and their costs; no evidence is provided that the approach is profitable.

Key ideas

  • A lock pairs equal-volume long and short positions in the same asset to offset directional exposure.
  • The robot can average into both sides and later close the pair or retain one side.
  • Trailing stops and breakeven moves are suggested for managing a position after unlocking.
  • Two positions can incur additional commissions, and forex rollover may add costs.
  • Locked positions continue to tie up margin, and choosing which side to close remains difficult.

Tags

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