• Overview
  • Reviews (3)
  • Comments (68)
  • What's new

Profit or Loss Pad

Closing positions in MetaTrader 5 upon reaching the total profit/loss with the profit trailing function.

You can enable the Virtual stops (Separate Order), calculating and closing for BUY and SELL positions separately (Separate BUY SELL), closing and calculating all symbols or the current symbol only (All Symbols), enable trailing for profit (Trailing Profit)

Positions are closed based on a value in deposit currency, points, % and drawdown.

The application is designed for use on any account together with any other EA or in combination with manual trading. As soon as the total balance of trades on some pair or all pairs is greater than or equal to the value specified in the settings, all positions are closed and orders are deleted.

This version is not only capable of closing a position at the specified profit level, but can also trail profit for better results.

You can also try our panel for МТ4 Profit or Loss for mt4

This pad EA is part of our "One Click Trading " - VirtualTradePad for mt5 system.

Find the detailed description and use examples in our blog (in Russian).


Main Features

  1. The panel can work only on its own symbol (Current Symbol) or consider the total profit or loss by all symbols (All symbols).
  2. The panel can be used as a virtual Stop Loss or Take Profit. Set the profit and loss values and enable the Separate Orders options. The panel will close positions separately upon reaching the specified profit and loss values in pips, USD and percent
  3. You can choose the close type: by profit in dollars, in pips or in % of balance or by loss in dollars, in pips or in % of balance.
  4. There is also the "CLOSE ALL" button that instantly closes the current symbol position or all positions (depending on your choice).
  5. The current state of your account is displayed right on the panel in three different ways corresponding to the close types.
  6. Profit can only be set above 0. If you set 0, the field will flash red. It means that the set value is invalid and this field will not be active. If you set a value with a minus, the EA will automatically move the field to a positive value (for example -100=100)
  7. Loss can only be set below 0. If you set 0, the field will flash red. It means that the set value is invalid and this field will not be active. If you set a positive value, the EA will automatically move the field to a negative value (for example 100=-100)


Usage

  1. Start the panel on your currency pair chart.
  2. On the panel select the option to close positions by all symbols or by the current symbol.
  3. To activate the options for selecting the close type, you need to specify a non-zero value for the corresponding parameters. Note that a positive value must be specified for the profit and a negative value must be specified for the loss, for example: -100.
  4. Check the options you want to use for closing (Profit\Loss in pips\dollars\percent).
  5. Enable the Close if Profit or Loss button, it should become blue. It means that the Expert Advisor has started working.
  6. Once the profit or loss of your position crosses the set levels, the positions will be closed.
  7. The emergency button CLOSE ALL is intended for closing all positions instantly.


Management

  1. All Symbols - enables closing for all symbols.
  2. XXXXXX only - only closing on the current pair the EA is running on.
  3. Separate BuySell - enables separate closing for BUY and SELL positions.
  4. Separate Order - separate closing for each separate positions.
  5. Profit $ - enables\disables closing by a total profit in USD or deposit currency.
  6. Profit p - enables\disables closing by a total profit in pips.
  7. Profit % - enables\disables closing by a total profit in percent of current balance.
  8. Loss $ - enables\disables closing by a total loss in USD or deposit currency.
  9. Loss p - enables\disables closing by a total loss in pips.
  10. Loss % - enables\disables closing by a total loss in percent of current balance.
  11. Close if Profit or Loss ON - the function closing by a total profit or loss is enabled
  12. Close if Profit or Loss FF - the function closing by a total profit or loss is disabled


Trailing Profit

Trailing based on configured parameters.

This function enables trailing for profit (floating profit) at closing.
In this case, the profit is not fixed but is closed with a trailing of the specified value. As soon as the profit reaches the specified value, the Expert Advisor saves the current profit level and starts trailing the profit.

Example:

If you made settings for closing at the profit of 10 dollars:

Profit $ - positive closing.

Profit $ - value of positive closing.

TrailingProfit- distance from Profit $, which, when reached, triggers trailing of profit.

If Profit $ is set to 10 and TrailingProfit is set to 5 the Trailing Stop will be set at 5 dollars. The Trailing Stop will come into play when the Expert Advisor passes the 10 dollar line and start moving following the profit. The Journal will show entries about the current profit status.

When the total profit falls below the last fixed level, TrailingProfit, the Expert Advisor will perform forced closing of all position.


External Parameters

  • Sounds - enable/disable sound alerts when opening/closing/modifying positions/orders;
  • HintShow - enable/disable popup tooltips;
  • English - enable/disable tooltips in English. If false, tooltips will be in Russian;
  • TypeFilling - type of position and order filling;
  • MagicNumber - magic number for positions and orders. 0 - no magic number;
  • UseAllMagicFromAllAccount - manage all positions for the given currency pair;
  • Show_Future_BE_TP_SL - display the breakeven, profit and loss levels on the current chart. The price of lines is calculated based on the values entered in fields Profit and Loss in points/USD/percents;
  • CLP_TralOptionsStep - step for modifying the profit level during profit trailing in units (points, deposit currency, percent);
  • CLP_DeleteStopOrders - delete pending orders when closing by the total profit or loss;
  • Use_Lots_in_CLP_Points - the EA will also consider the lot of those positions during calculation of profit points. This option can be useful in trading on a hedging account with different lots;
  • AutoCorrect_LevelCLP - only negative values can be used in the Loss field. If the user enters +10, the system will automatically change the value to -10;
  • CPL_AlerT/Mail/Push - show an alert about closure with profit or loss in the terminal chart;
  • CPL_CloseTerminalAfterClose - close the terminal after closing all positions;
  • CPL_AUTOOFF_AfterClose - disabling the "Close by total profit or loss" button after closing all positions;
  • Configuring size of text elements on the pad
  • Color settings of the pad/information
  • LimitFor - if you decide to limit loss for the current custom magic number, this can be done in the new block;
  • LimitForLosses - limit of loss in the deposit currency;
  • LimitForProfits - limit of profit in the deposit currency;
  • NotificationMailSend - enable/disable sending of push/email notifications upon reaching the limits.
bsandaruwan
753
bsandaruwan 2016.01.17 15:16 
 

Before talk about the EA I like to talk about Author

He is the best Author I saw in Mql5

His service 5star for me.

Very kind and honest person

Always response with very patient & professional way with his Knowledge.

Profit or Loss Ea very useful for me.

Its work very well with all currency pairs.

Extremely happy with Ea

Thx Lot Vladislav for your nice EA’s and 5 star Service.

Frederic Fachard
1319
Frederic Fachard 2015.05.26 18:37 
 

I bought this product in january 2015.

I'm happy with it :)

It really makes what he is supposed to !

It can close order(s) for a specified symbol OR ALL orders

Setting of the targets (win and/or loss) are easy to setup (in account currency and/or points and/or % of balance)

Hint :

About setting the targets in "loss", don't forget to ADD THE MINUS SIGN BEFORE THE VALUES ;)

For example, if you enter positive value (without the minus sign) on "Loss $" field, the order may be immediately closed !

In loss section, you have to enter "-5.00" if you want the order to close when your loss reached USD 5.00 ...

Things that could be enhanced :

- When market is fast moving, the EA have some difficulty to follow... (the target may be reached for a flash moment and sometimes the EA miss it...)

- Maybe an alert by email and/or push when the EA closes some order with details about what have been done.

All in all, thank you for this nice product :)

Giovanni Pascoli
1452
Giovanni Pascoli 2014.04.24 19:01 
 

Very good expert. Thank you.

Version 18.515 - 2018.05.23
- Fixed the error with profit trailing and closure at a loss, which occurred when using the closing on all symbols.

- Added a variable for specifying the currency pair for the panel to work with: SymbolToTradeCustom
This allows working on offline charts (Tick charts, Renko charts, etc.).
Attention: Be careful when writing the name. The name should exactly match the name in the Market Watch!
EurUSD - incorrect!
EURUSD - correct!
If this parameter is not set, the EA works on the currency pair it is attached to.

- Added the ability for Magic Target to work on an offline (Tick, Renko...) chart.

- Added the indication of the feature operation to the CLP tab.
If the indication is red, the feature is disabled and does not work;
If the indication is green, the feature is enabled and working.
Version 18.309 - 2018.03.14
Fixed an error in the Close ALL button.
Version 18.227 - 2018.03.06
- Added support for font scaling in Windows (font size settings are not available);

- Added support for multiple magic numbers. Updated the MagicNumber parameter: the first number denotes the magic number for opening positions and management. It is also possible to set multiple magic numbers to be managed;
For example:
--- MagicNumber=777 UseAllMagicFromAllAccount=true: the EA monitors all positions on the current symbol and on the entire account;
--- MagicNumber=777 UseAllMagicFromAllAccount=false: the EA monitors positions with the magic number 777 on the current symbol and on the entire account;
--- MagicNumber=777,888 UseAllMagicFromAllAccount=false: the EA monitors positions with the magic numbers 777 and 888 (opens positions with the magic number 777) on the current symbol and on the entire account;
--- MagicNumber=777,888,999 UseAllMagicFromAllAccount=false: the EA monitors positions with the magic numbers 777, 888 and 999(opens positions with the magic number 777) on the current symbol and on the entire account;

- When a new object appears on the chart, the panel is refreshed to avoid overlapping of objects on the panel;
Version 17.979 - 2017.12.12
Cosmetic changes.

A new parameter has been added: CPL_AUTOOFF_AfterClose allows disabling the "Close if profit or loss" button after closing all positions.
The button is only disabled when ALL! positions are closed.
It takes into account the magic number specified in the EA, as well as the symbol for closing.
If closing only 1 currency is selected and the CPL_AUTOOFF_AfterClose parameter is enabled, the EA waits for all positions on the given currency pair to be closed, and can disable the button only after that!

BugFix: Fixed dragging of trade levels (Stop Loss, Take Profit) when hovering over the panel and back.
Version 17.970 - 2017.11.13
In the EA settings, changed the option for closing the terminal after all trades are closed.
Parameter CPL_CloseTerminalAfterClose - enable closing the terminal.
CPL_CloseTerminalAfterClose = true.
Terminal is closed only when ALL! positions are closed.
It takes into account the magic number specified in the EA, as well as the symbol for closing.
If closing only 1 currency is selected. If the CPL_CloseTerminalAfterClose parameter is enabled, the EA waits for all positions on the given currency pair to be closed, and cab close the terminal only after that!


Added the Show_Future_BE_TP_SL parameter to CLP - show the lines of the future position closure by total profit or loss.
Attention: it works only on the current symbol and with the 'SEPARATE Orders' mode disabled.
The lines are displayed separately for Buy and Sell positions, or by a common line.
If a line is not shown, then the positions form a lock that cannot be closed by the total profit or loss.
Note: line and price data may be inaccurate for floating spread.
Remember! SELL is closed by ASK, while BUY is closed by BID

Profit trailing can now be enabled only after setting the parameters for closing by profit.

Added the profit trailing values on the CLP panel near the input box for the distance of Trailing Profit. The value appears when the trailing level is fixed by the EA and shows the fixed level for closure.

Added block of alerts for profit and loss in the deposit currency.
If you want to limit the losses on the current client magic number, you can do that in the new block.
For example: you need the EA to send you emails and display on-screen alerts when the total loss of open and closed trades within LimitFor becomes less than -100 USD:

Set the parameters to the following:
LimitFor=0;
LimitForLosses=-100;
LimitForProfits=0;

After receiving the daily loss of -100 USD in history for the given magic number, the EA displays an on-screen alert and sends an email.
Attention: this block does not close trades! It simply displays alerts!
At the next LimitFor, this parameter is reset to 0.

You can select LimitFor= DAY;WEEK;MONTH;ALLTIME;
You can also enable sending email and push notifications when reaching the limits of NotificationMailSend

To the CLP panel for closing by profit or loss, added a block of notifications when closing positions by profit or loss. 3 notification methods are available:
CPL_AlerT - alert message
CPL_Mail - email message
CPL_Push - push notification
How to set up mobile device or email to messages from the Expert Advisor:
https://www.metatrader4.com/en/trading-platform/help/setup/settings_notifications
https://www.metatrader4.com/en/trading-platform/help/setup/setup_email


the MagicOrderToClose parameter has been replaced by 2 parameters:
MagicNumber - unique magic number of positions to close.
UseAllMagicFromAllAccount:
true = apply the function of closing by total profit or loss to all magic numbers.
false = set the unique magic number for closing positions in the MagicNumber parameter.
Version 17.504 - 2017.05.11
- Fixed the error with the display of fractional numbers on the CLP panel: when entering fractional numbers in the fields Dollars, Percents and Profit trailing
Version 17.118 - 2017.01.24
Fixed operation with long tickets
Version 17.105 - 2017.01.13
-Added parameter Use_Lots_in_CLP_Points for working with the CLP tab - true - the EA will also consider the lot of those positions during calculation of profit points. This option can be useful in trading on a hedging account with different lots.

For example:
opened 2 SELL positions on EURUSD
SELL 0.01 with profit of 20 and 0.2 USD
SELL 0.02 with loss of -12 points -0.24 USD

-If Use_Lots_in_CLP_Points = false the EA will calculate the "net" points.
In this case, the Profit will be: -0.04 USD or 8 points.
As we can see, the position gained profit in points, but it is a loss in USD.

-If Use_Lots_in_CLP_Points = true the EA will calculate points with consideration of lots.
In this case, the profit will be: -0.04 USD or -4 points.
If calculation of profit is in points and the "Include lots in profit calculation" is enabled,
the EA will find the minimum lot of the provided positions and calculate the Points on that basis.
For example:
Minimum position 0.01, 1 "net" point = 1 point,
If a position is opened with a lot of 0.02, then 1 net point = 2 points with consideration of the lot.
If a position is opened with a lot of 0.05, then 1 net point = 5 points with consideration of the lot.

-Added checking of the input values for closing profit or loss:
If the specified profit is lower than the current - system generates a warning and disabled the closure mode.
If the specified loss is greater than the current - system generates a warning and disabled the closure mode.
If set to 0 and user attempts to enable closure - system generates an error.
-Added the AutoCorrect_LevelCLP parameter:
Only negative values can now be entered to the loss field. If user enters +10, the system automatically converts it to -10.
Only positive values can now be entered to the profit field. If user enters -10, the system automatically converts it to +10.

Only a positive value can be entered in the CLP_TralOptions, otherwise the EA generates an error.



-Added the SEPARATE Orders option to the CLP panel for separate calculation and deletion of each position.
"Virtual Stop Loss and Take Profit" mode.
For example, if you set closure by loss to $ -5 and closure by profit to 100 points, each trade will be closed separately by a loss of $ -5 or by profit of 100 points.


-Added the Separate BUYSELL option to the CLP panel, which allows to calculate a close positions by the net profit or loss separately for BUY and for SELL.
Version 16.930 - 2016.10.03
Updated the algorithm for working on hedging accounts
Fixed the error in the TrailingProfit edit box
Version 16.128 - 2016.02.01
Added the function to save the settings during the terminal reboot, the change in settings inside the panel, when closing the panel on the chart and attaching the panel to the chart.
All variables and data changes made in the panel are now saved when the terminal is restarted.
If you turn off the terminal and turn it on again - all the parameters will be re-loaded from the global variables.

Added the TrailingProfit function to the CLP tab:
Trailing Stop at Closing.
A new function for trailing profits has been implemented on user demand. In this case, the profit is fixed with some correction. As soon as the profit reaches the specified value, the Expert Advisor saves the current profit level and starts trailing the profit.

For example:
If you made settings for closing at the profit of 10 dollars:
Profit $ - positive closing.
Profit $ - value of positive closing.
TrailingProfit- distance from Profit $, which, when reached, triggers trailing of profit.
If Profit $ is set to 10 and TrailingProfit is set to 5 the Trailing Stop will be set at 5 dollars. The Trailing Stop will come into play when the Expert Advisor passes the 10 dollar line and start moving following the profit. The Journal will show entries about the current profit status.
When the total profit falls below the last fixed level, TrailingProfit, the Expert Advisor will perform forced closing of all position.

The function works for all closure types: Every symbol, Current symbol, Separate BUY and SELL direction, Each order separately.
Version 15.923 - 2015.09.24
Fill policy parameter has been added to the external parameters:
TypeFilling=FillOrKill


FillOrKill
This fill policy means that an order can be executed only with the specified volume. If the required volume for a given financial instrument is currently unavailable in the market, the order will not be executed. The required volume can be filled using several offers currently available in the market.


ImmediateOrCancel
This means that a trade will be executed with the maximum volume available in the market within the value indicated in the order. In case entire order volume is not available in the market at the moment, a partial fulfillment is possible, but any portion that cannot be filled immediately is canceled.


Return
This fill policy is used for market, Limit and Stop Limit orders and only in the Market Execution and Exchange Execution modes. In case of partial filling a market or Limit order with remaining volume is not canceled but processed further.
When a Stop Limit order triggers, a relevant Limit order will be placed with the Return fill policy.
Version 15.116 - 2015.01.16
In case of incorrect settings, the Close button will be disabled and an error will be returned to the user.
Version 15.112 - 2015.01.13
Added check of input data before the start of algorithm operation. Protection against incorrect settings.
For example, if you specify the loss of more than the current one - the system will not allow you to perform the algorithm. Since the positions must be closed immediately.
For example: You have indicated close loss at 2 dollars. Currently loss is -3 dollar. This means that you obviously specified closing level below the current one. And the system will immediately close the position.
In this version, the system returns an error and asks you to enter another value.

If your сurrent loss is -5 dollars, you can set the loss value only -5.1 or below.

If you have a current profit of $10 and you want to set it to $5 - the system will return an error. You can set the value for locking the profit only above the current profit. For example, $11.