Skip to content
All library documents

Risk-Based Order Sizing with Stop Loss and Take Profit Settings

Article MQL5 code base

Summary

This script is a utility for opening orders with configurable risk and identification settings. It allows the user to choose a fixed position size or calculate position size from a risk percentage and the selected stop-loss distance. Stop loss and take profit are specified as distances from the current price, while a magic number and comment can be assigned to the order.

The document outlines order-entry controls rather than a complete trading strategy. It does not explain how to choose the risk percentage or exit distances, how the size calculation handles contract specifications or execution costs, or whether orders are validated against account or broker limits. It provides no backtest or performance evidence, so the described features should be understood as configurable mechanics rather than proof of risk control or profitability.

Key ideas

  • The script supports either fixed position size or sizing based on risk percentage and stop-loss distance.
  • Stop loss and take profit are entered as distances from the current price.
  • Orders can be labeled with a magic number and a comment.
  • The description does not specify calculation details or provide performance evidence.

Tags

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