When MT4 Tracker generates a modified portfolio EA for the purposes of excluding poor-performing strategies or for collecting statistics when testing the portfolio EA in MT4’s Strategy Tester, it adds some additional code to the *.mq4 source code file — including new input values intended to add trading protection when the portfolio is running in an account. The new inputs are described below.
Input Values Entered When Attaching The Portfolio EA To A Chart
Your portfolio EA may contain dozens of strategies, and managing the overall trading pattern of a portfolio EA is much different than a single EA — i.e. if you don’t pay close attention then your exposure can quickly grow larger than what you are comfortable with. These inputs allow you some control over how frequently your portfolio will open new positions.
Stop all trading: When set to ‘true’ then do not open any new trades — effective immediately. Default is ‘false’.
Stop trading when FreeMargin drops below this value: If account’s Free Margin drops below this value then do not open any new trades. Default is ‘0’.
Stop trading when Margin exceeds this value: If account’s Margin rises above this value then do not open any new trades. Default is ‘99999’.
Stop trading when floating loss drops below this value: If account’s floating loss drops below this value then do not open any new trades. Default is ‘-99999’.
For example, suppose you want to stop using a portfolio EA but there are still a number of open (pending) trades. If you set the 3rd input (‘Stop trading when Margin exceeds this value’) to ‘1’, then no new trades will be opened and pending trades will gracefully close. The alternative would be to remove the EA (or close the chart window) and then manually close each pending trade.
The 3rd input can also be useful if you wish to limit the number of pending trades if you discover the portfolio is opening more trades than you are comfortable with.
Minimum WinRatio (per strategy): If a strategy’s WinRatio falls below this value (e.g. 0.50), then it will no longer be able to open new positions. However, it will still be used to close any positions that currently remain open.
Most Recent Number of trades: This refers to how many trades are used when computing the minimum WinRatio (above).
Maximum Consecutive Losses (per strategy): If a strategy’s consecutive losses exceeds this value (e.g. 2) , then it will no longer be able to open new positions. However, it will still be used to closed any positions that currently remain open.