Skip to content
All library documents

Fixed Stop and Target Sizing by Deposit Risk

Article MQL5 code base

Summary

This trading script opens a sell position with a stop loss and take profit set at fixed point distances from the current price. Its key risk-management feature is sizing the position from a user-selected loss amount expressed as a percentage of the account deposit. Given the stop distance and chosen risk percentage, the script calculates the lot size intended to limit the loss if the stop is triggered.

Other inputs set allowable price deviation and the number and spacing of retries for unsuccessful order attempts. The described method links position size to the distance from entry to the stop, rather than using a fixed lot size. The document does not explain how the calculation handles contract specifications, commissions, slippage, or gaps, and it provides no test results. The stated settings illustrate inputs, not a recommendation for risk limits or trading conditions.

Key ideas

  • The script opens a sell position using fixed stop-loss and take-profit distances from the current price.
  • A deposit-risk percentage and stop distance determine the calculated lot size.
  • Inputs also control price deviation and retries for failed trade attempts.
  • The document does not discuss costs, gaps, instrument-specific sizing, or results.

Tags

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