• Overview
  • Reviews
  • Comments

Volume Optimizer

Volume Optimizer is a script for calculating the optimal trade volume. The volume is defined by a trade history and optimal risk theory described in my article.

Trading always implies uncertainty. Even if a trading system is generally profitable, we can never be sure that each of its trades actually brings positive result. Too great trade volume may significantly reduce the capital, while too low volume may hinder the system from achieving its potential in full. Volume Optimizer allows you to strike a balance between these two alternatives.

The following parameters are set when launching the script:

  • Text file name with a history of trades. Each trade there is accompanied by a line with Open, Close and stop loss prices. These prices go in the exact mentioned order and are separated by a single space. When launching the script, the file should be in the script's working folder. Otherwise, it is created by the script and filled with sample trades.
  • G0 — minimum acceptable average profitability in a trade series.
  • D0 — minimum acceptable capital increase. It defines the available relative drawdown.
  • delta — criterion significance level for defining the optimal risk. It is marked as δ in the above mentioned article. This is a positive quantity less than one. The closer it is to zero, the more accurate the criterion, but the smaller the obtained trade volume.
  • Open and stop loss prices for a trade, for which a volume should be defined.

The remaining data is obtained from the active chart symbol properties.

The script's working file is called Volume Optimizer and located in MQL5/Files. If it is not present, the script creates it on its own. The script operation results are added to the end of the output.txt file at each launch. The file is located in the same working folder (or otherwise, created by the script as well). The script operation result is shown on the screenshot.

No reviews