What is Equity Sentry
Protecting your account equity is one of the most difficult functions if you need to do this
manually. Did you ever used some MT4 expert advisor that opens trades using some mysterious
trading system and your account floating loss keeps growing more and more? In other words
your account equity keeps getting lower and lower until your account money is loss because of
the margin call. I bet this is the scenario no one ever wants to see, but how to close all the
trades when account equity reaches certain amount in percent, money or pips? This could
happen at night when you sleep or some other time when you are away from your computer.
We have developed a special MT4 EA that will be your personal account equity sentry. EA will
monitor your account equity and close all trades when a certain amount in percent, money or
pips is reached. You can even set EA to use multiple functions for act as account equity stop loss
or take profit. Equity Sentry also has “cumulative trades basket”. It means that EA can calculate
the profit/loss of your closed trades and once it reaches certain level EA will act. Also “close MT4
platform” feature is included, which is very useful if you use trade copier software to receive
trades as most of the trade copiers does not stop operating when “Expert Advisors” are
disabled. In this case Equity Sentry EA can close your MT4 completely after all trades are closed.
How to Install Equity Sentry
1) Copy Equity Sentry EX4 file to your Metatrader 4 folder under \experts\
2) Restart MT4 if it was running during this short installation process
3) Locate Equity Sentry under “Expert Advisors” in the “Navigator” (Ctrl+N) window
4) Click and drag EA with your mouse left button to the desired chart or just double-click it
to run. EA must be attached only to the single chart.
5) In the EA settings window “Common” tab you should enable “Allow live trading” and
“Allow DLL imports”. Otherwise EA will not work.
6) Set any other desired settings and click OK to run EA
7) You should see smiley face in the top-right corner of the chart
8) On your Metatrader toolbar, make sure that Experts
Advisors are turned on (green)
9) A blue box with the EA settings will appear on the chart when EA will start running
How to use Equity Sentry
1) Once started EA will start monitoring current account equity and all upcoming closed
trades
2) You can set EA to close all trades and disable all EAs when account equity reaches a
certain loss or profit level in percent, money or pips. You can choose multiple options like
close all trades when account reach certain profit in percent or certain loss in money.
3) You can set EA to close all trades and disable all EAs when certain cumulative profit or
loss level is reached in money or pips.
4) Profit or loss target in money depends on your account currency. If you have USD
account, profit/loss target will be in USD, if your account is in USD, profit/loss target will
be in USD.
5) By default EA will manage all trades running on your account, but you can override this
by setting certain magic number in EA settings.
6) All values must be positive.
7) By default EA is set to disable all Expert Advisors on equity trigger. This means that after
EA will close all trades it will try to disable all EAs by virtually clicking “Expert Advisor”
button on your Metatrader toolbar. This will disable all EAs including Equity Sentry and
no trades should be opened by any EA until manual intervention. Note that we can not
guarantee that this will affect all EAs. Some EAs (like for Renko or other offline charts)
work in different mode and they can not be disabled until removed from chart.
8) You can set EA to use Trailing Stop and/or BreakEven function on your trades.
9) You can set EA to close your MT4 platform completely
Equity Sentry settings
DisableAllExpertAdvisors – by default this value is set to true and it means that EA will disable
all Expert Advisors on equity trigger or certain cumulative profit/loss reached. This means that
after EA will close all trades it will try to disable all EAs by virtually clicking “Expert Advisor”
button on your Metatrader toolbar. This will disable all EAs including Equity Sentry and no
trades should be opened by any EA until manual intervention. Note that we can not guarantee
that this will affect all EAs. Some EAs (like for Renko or other offline charts) work in different
mode and they can not be disabled until removed from chart.
“Expert Advisors” button should change from
To
CloseMetatraderCompletely – by default this value is set to false. If you set it to true EA will
close MT4 platform completely on equity trigger or certain cumulative profit/loss reached. This
is very useful if you use trade copier software to receive trades as most of the trade copiers does
not stop operating when “Expert Advisors” are disabled.
EquityLossPercent – when account loss equity in percent will reach this value EA will close all
trades. Set this value to zero to disable it. Value must be positive.
EquityLossMoney – when account loss equity in money (account currency) will reach this value
EA will close all trades. Set this value to zero to disable it. Value must be positive.
EquityLossPips – when account loss equity in pips will reach this value EA will close all trades.
Set this value to zero to disable it. Value must be positive.
EquityProfitPercent – when account profit equity in percent will reach this value EA will close all
trades. Set this value to zero to disable it. Value must be positive.
EquityProfitMoney – when account profit equity in money (account currency) will reach this
value EA will close all trades. Set this value to zero to disable it. Value must be positive.
EquityProfitPips – when account profit equity in pips will reach this value EA will close all
trades. Set this value to zero to disable it. Value must be positive.
CumulativeLossMoney – when cumulative profit/loss amount in money (account currency) will
reach this loss level EA will close all trades. Set this value to zero to disable it. Value must be
positive.
CumulativeLossPips – when cumulative profit/loss amount in pips will reach this loss level EA
will close all trades. Set this value to zero to disable it. Value must be positive.
CumulativeProfitMoney – when cumulative profit/loss amount in money (account currency)
will reach this profit level EA will close all trades. Set this value to zero to disable it. Value must
be positive.
CumulativeProfitPips – when cumulative profit/loss amount in pips will reach this profit level
EA will close all trades. Set this value to zero to disable it. Value must be positive.
IncludeCommissionsAndSwap – if set to true, EA will include order commission and swap when
calculating total profit/loss.
MagicNumber – this is where you set magic number that will tell EA which trades to monitor
and close. By default magic number is set to -1 which means EA will manage all trade regardless
its magic number. This means that the trade may be opened manually and/or by 3rd party
software. If you set MagicNumber value to zero, EA will manage only the trades that have no
magic number set which is usually manually opened trades. Otherwise you can set this value to
a certain number and EA will manage only the trades that have the same magic number. For
example if you set MagicNumber=1234, EA will manage only the trades that have magic
number set to 1234 as well. This way you can set Equity Sentry EA to monitor the trades of an
individual 3rd party EA or group of the EAs.
TrailStopStartPips and TrailStopMovePips – EA will activate Trailing Stop function when trade
goes in profit by pips value set in TrailStopStartPips. Once activated EA will move stop loss in
profit every pips value set in TrailStopMovePips
BreakEvenStartPips – sets how many pips trade should get into profit before stop loss is
moved to the entry price. BreakEvenMovePips is used to set how many pips EA must add to
the entry price if you want your trade to be closed in profit on reverse.
UninterruptibleMode – normally every EA on MT4 platform runs based on price ticks. This
means that when a new price tick is received from MT4 broker server, the EA will perform its
functions. As you may know there can be delay sometimes and new price tick may not be
received in 5 or more seconds when markets are calm. This may cause delay in Equity Sentry
functions to be applied to your trades. If you set UninterruptibleMode=true, EA will not wait for a
price tick and will perform all of its functions every second without any delays.
DashboardDisplay – this setting control how you want EA to display the dashboard (Blue Box).
If this value is set to 0 (zero), EA will not display the dashboard. If you set this value to 1, EA will
display the dashboard without background. If you set this value to 2, EA will display the
dashboard with the background set by DashboardColor and our company logo at the bottom
right corner. To display dashboard on top of the chart you may need to uncheck “Chart on
foreground” box in the chart properties window (F8) “Common” tab.
Dashboard and logo position on screen were chosen wisely.
Notice that the dashboard is aligned to the left but there are space left. This space is
reserved for your trade ticket numbers. Notice when you open trade and MT4 platform
display trade type (buy/sell) and ticket number at the left of the chart. This is why
dashboard is moved a bit to the right to not cover that information.
Vertical alignment of the dashboard is set to the top but there is some space left and that
is where EA will display critical errors in red bold text. This is very helpful to not miss any
critical errors.
Company logo is displayed in the bottom-right corner. If you enable “Chart Shift” your
chart will be moved away from the right border and logo will not cover your chart price.
With “Chart Shift” enabled it is easier to read the chart and indicators. Also many other
3rd party indicators and EAs use that space to display various info in the top-right corner.
What is slippage?
The short answer is that slippage is what happens between the time you close/place an order to
buy or sell a currency and the time that your oder is filled, i.e., the time that the transaction is
completed. In most cases, in a fast-moving volatile market such as EUR/USD (Euros and US
Dollars), from the time you place an order until the time it is filled the exchange rate will often
change anywhere from $.0002 to $.0003 from the price you saw and wanted to get when you
placed your order, even with the fastest automatic electronic ordering software. If you are
trading by hand, i.e., sending your order to your broker via a non-automatic signal generating
platform, then you can expect slippage to be as much as $.0010 to $.0015! The same is applied
when you are closing the trade or deleting pending order.
What is “Stop Level” or “Minimum Distance Limitation”?
The “Stop Level” is the minimum distance limitation between the market price and entry/stop
price. This value is different among brokers like the Spread value. The “Stop Level” value can be
variable as well, it means that it can be changed by your broker during news releases.
This value is controlled by your broker and can not be changed.
Example: if your account has “Stop Level” set to 6 pips, it means that stop loss, take profit or
entry price should be set at least 6 pips from the current market price. Any SL/TP/Entry price
closer to current market price than 6 pips will be denied by your broker.
The StopLevel limitation is explained on MQL website http://book.mql4.com/appendix/limits
Please look for “StopLevel Minimum Distance Limitation” on that webpage.Trading foreign exchange on margin carries a high level of risk, and may not be
suitable for all investors. The high degree of leverage can work against you as well
as for you. Before deciding to invest in foreign exchange you should carefully
consider your investment objectives, level of experience, and risk appetite. The
possibility exists that you could sustain a loss of some or all of your initial
investment and therefore you should not invest money that you cannot afford to lose. You
should be aware of all the risks associated with foreign exchange trading, and seek advice from
an independent financial advisor if you have any doubts.