Protective Basket Close Using Account-Scaled Loss Limits
Summary
This document describes a utility that monitors a selected basket of open positions and attempts to close that basket when its floating loss reaches a user-set threshold. The loss limit can be a fixed cash amount or a percentage of account balance or equity; the author favors a percentage to keep the threshold proportional as account size changes. Users can scope monitoring to the whole account, one symbol, or selected strategy identifiers, and can optionally set a basket profit target.
At the trigger, the tool snapshots the basket’s tickets so later positions are excluded. It retries rejected closes on a timer, checks server responses, and stops after repeated rejection while alerting the user. It can re-arm or stop after triggering, and avoids arming automatically if the loss is already beyond the limit when attached. Floating result includes position profit and swap, but not open-position commission. The terminal must remain running, overlapping instances may race, and the document supplies no independent reliability or performance results.
Key ideas
- A basket close can trigger at a cash loss threshold or a percentage of account balance or equity.
- The monitored basket can be scoped by account, symbol, or strategy identifiers.
- A trigger snapshots the current positions so newly opened trades are not included in that close attempt.
- The utility retries failed closes, checks server responses, and stops after repeated rejections.
- Floating result includes profit and swap but excludes commission on open positions.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.