Profit & Loss Calendar

Profit & Loss Calendar

4 July 2023, 11:58
Keni Chetankumar Gajanan -
0
538

Monitoring your trades over time helps you build up your account balance and shows when you miss your goals. Traders on the MetaTrader platform have always wished for a functional Profit and Loss Calendar.

Viewing the closed trades of a symbol on the chart can help you adjust your strategy for better results.

Maintaining a trade book allows you to record the applied strategy and/or note the reason for taking each trade. It helps you to evaluate and refine strategies based on its profitability. A possibility to download the Account history as a text file with delimited fields, allows upload to MS Excel and helps create a Trade Book. Also, these downloads are required regularly.

| Monitor your trades to Profit |

The P&L Calendar expert advisor (utility) provides the above in a user-friendly interface. It makes use of the MetaTrader's pre-installed functions of being able to move the panel on the chart or minimize it when you don't need it.

The functionalities included are:

P&L Calendar Panel shows a calendar view for all the closed trades of your account.

  • You can choose the month to display the day-wise and week-wise totals.
  • Displays the monthly, quarterly and half yearly totals for the chosen year.

Account Information Panel shows the following for you to take timely decisions:

  • The current Account Balance, the equity based on profitability of open positions and the Margin used.
  • A summary of your current P&L for the year, month, week and current date.

Symbols (to trade) Panel displays the breakup of the total profits as per the symbol traded. You can also choose your preferred symbols by saving them in a file (set).

  • Highlights the current chart symbol from the list.
  • Allows selection of a symbol from the list to be applied on chart by click of a button.

Open Trades Panel displays the open positions for selected symbol and allows display of trade information on the chart. It also displays summary totals of open positions for individual symbol along with the average price.

  • Displays trade information for symbols with open positions.
  • Shows individual trades for selected symbol along with its summary information.
  • Displays the open price, stop loss and take profit of selected position on chart. Also displays the average price of all open positions for symbol on chart.

Download History allows the export of the account history to a text file.

  • A selected delimiter separates the file contents for easier import to Microsoft Excel.
  • The downloads are incremental, allowing retention of records even if MetaTrader has archived it.

View closed trades for symbol on the chart.

  • Displays the trade information as a tooltip.
  • Customise the format of lines displayed.
Product Links:
MT5 version
MT4 version

| P&L Calendar - User Guide |

This document details the functionalities and is also a guide on how to configure the indicator.

Customize the Main Panel on startup

You can select the Panel to be shown on startup. Accordingly, the other will be considered as a sub-panel.

Selection of Main panel

P&L calendar makes use of the MetaTrader's pre-installed functions of Panels. The main panel can be minimized whenever you need to hide the display of both panels.

The sub-panel can be dragged with the mouse independent to the main panel, but when the main panel is moved, the sub-panel moves along with it on the chart. The close button on the sub-panel will close it, while the close of the main panel will remove the expert advisor from the chart. As the sub-panel is tied to the main panel, it will also close. You need to insert/re-drag the expert advisor back to the chart.

If P&L Calendar is the Main panel, you can click on Account Information - Open button to open the Account Information panel and click on  Account Information - Close button to close it.

If Account Information is the Main panel then click on  PnL Calendar - Open button to open the P&L Calendar panel and click on  P&L Calendar - Close button to close it.

Panel - Profit & Loss Calendar

P&L Calendar accesses the closed trades from your Account History and displays them as a monthly or yearly (per quarter or half yearly) calendar.

Month view of your profits

Month P&L Calendar

Clicking on the 'Month' button displays the day-wise and week-wise totals of your closed trades for the month selected from the combo list  Combo list - Month The month total is also displayed. The current date totals are displayed as 'Today'.

The list of months shown in the combo starts from the earliest month retrieved from the account history to the current month.

NOTE: P&L Calendar EA will only display trades as shown in the Account History tab. To show all trades from history, you need to choose "All History" on right clicking on the tab.

All History selection


Year view of your profits

Monthly, Half yearly and Quarterly totals

Clicking on the 'Year' button will allow you to choose  Year selection for the selected year from the combo list. The list of years are as retrieved from the account history of closed trades.

The month, half yearly, quarterly and year totals are also shown in the panel.

Panel - Account Information

The Account Information panel highlights the current status of your open positions to take timely action. There are two designs for the Account Information panel based on the selection of Main Panel on startup.

Account Information

It shows the Account Balance, the Equity balance and the Margin of the open positions. The panel also shows the P&L realtime summary for Year, month, week and today.

As default, today's information shows the running account profit or loss, inclusive of the profit or loss for the closed trades (for today). Clicking on  Running Profit or Loss shows the current running profit or loss.

The Margin formatting can be customized by choosing the below options:

Margin Formatting

The colour for the Margin value will change once the defined threshold percentage of Account Balance is exceeded.

Panel - Symbols (to trade)

The Symbols Panel displays a breakup of running profit for the symbols traded. The indicator shows the panel by clicking the Symbols Panel Open button on the Account Information Panel and Symbols Panel Close to hide.

The Symbols Panel also allows a view of to your preferred symbols stored in a (set) file. The name of the file can be entered in the following input parameter.

Symbols set filename

The file is similar to the symbols set created from Market Watch. To know more on how to create the file, you can refer to the addendum section at the end of this user guide.

The Symbol on charticon highlights the current symbol of the chart. On clicking on Change Symbol on chart button, the current chart will change to a selected symbol.

NOTE: The Symbols Panel button is shown only if "Account Information" is the default Main Panel on startup (input parameters).

You may click on  View Open Trades to get detailed information on individual trades for symbols having open positions.

Panel - Open Trades

Detailed information for the open positions can be viewed on the Open Trades panel by clicking  View Open Trades icon on the Symbols Panel and  Hide Open Trades Panel to hide it.

There are three sections on the Open Trades Panel. On the left, the list of symbols with open positions are shown. In addition to individual symbols, you may choose 'All' to show open positions for all symbols.

Symbol selection

The selection of a symbol can be done by clicking the radio button. Accordingly, the detailed information of open positions for selected symbol will be shown on the right. In case of 'All', open positions for all symbols will be displayed. Along with the details of the trade, the current profit and points (distance) from the Bid/Ask price for each trade is shown.

Open Trades for symbol

Clicking on the checkbox on the right, will display the Open Price, Stop Loss and Take Profit price on the chart as below. Please note that the checkbox is shown only if the trade is for current chart symbol.

Price lines on chart

The bottom section on left of panel shows Profit, the swap fees (if any) and totals for Buy and Sell positions for the selected symbol. Also shown is the volume (lot size) for each trade type and its total.

Totals for Buy and Sell

On the right the Average Price for the open positions is shown. Clicking on the checkbox will display the Average price on the chart. Please note that the checkbox is only shown if the trade is for current chart symbol.

Average Price line on chart

The line displays the distance in points from Bid price along with the average price. Closing the Open Trades panel or minimising the Account Information Panel will not hide the line from the chart. To hide (erase) the average price, you may click on the  Erase Average Price line icon.

In case there are both, Buy and Sell positions for a symbol, along with the Average price for all trades, the Panel will show Average Buy price for 'Buy trades' and the Average Sell price for 'Sell trades'. A checkbox is shown for selection to display those price lines on the chart.

Button - Download History

Clicking on  Button - Download History button, download the trades closed post the previous download. The details of the download are highlighted in a Message Box confirming the download. Any error will be displayed as an Alert.

Message - Download completed

As the downloads are incremental the EA will check whether the trade is already existing in the download file and add it if missing. This will ensure that the trade exists in the file even if the Market Maker has archived it.

The EA allows you to the choose the delimiter used to seperate the fields in the text file. The available options are as below:

Delimiter - Options

NOTE: Please do not change the delimiter once decided, as incremental downloads may encounter issues. Do take regular backups of the downloaded file.

The following are the details of a row in the text file:

Content Name Description
Market Maker Market Maker Company where the Account has been opened
Ticket #
Ticket No. Ticket number for the trade
Open Time
Open Time Time when trade was opened
Trade Type
Trade Type Type of Trade
Symbol
Symbol Symbol for the trade
Lot size
Lot size The Lot size
Open Price Open Price Price at which trade was opened
Close Price
Close Price Price at which trade was closed
Close Time
Close Time Time when trade was closed
Points
Points Total points between close and open price
Profit
Profit Profit or Loss for the trade
Fees
Swap Fees Any commision, swap fees charged by Market Maker
Net Profit
Net Profit Net Profit or Loss for the trade
Magic #
Magic No. The Magic number for the trade (in case an EA has been used to open trades) else is 0
Button - View Closed Trades

Click on  View Trades - Open button to view closed trades for symbol on chart and on View Trades - Close to hide them. The displayed line is shown from the trade open to close time. A tooltip displays the information for each trade.

View Trades of chart Tooltip - Trade Information

The styling of the line can be configured as below:

Line Styling

The line style has options as provided by MetaTrader. The Line thickness is defaulted to 1 in case the Line Style value is other than 'Solid'.

Styling and Formatting

Below explains on how you can configure the “Font and Color Settings” for the text and grid displayed on the panel

Text Styling
Configure the font style and size of text displayed on the panel.

Colours Used
Configure the colours used for display of text and grid columns on the panel.


Disclaimer: Past performance may not show future results. You cannot hold me responsible for use of the indicator or expert advisor and for any information provided in this document.



Addendum

Following are the steps to create the symbols set file.

  1. Add the desired symbols to the Market Watch
  2. Right click the mouse on the symbols section to get a popup
  3. Select the "Sets" and "Save as" option to save the file. You can select the following folder (C:\Users\<<your user directory>>\AppData\Roaming\MetaQuotes\Terminal\<<MetaTrader folder>>\MQL<version>\Files\PnL Calendar\Data)
  4. Enter the name of the file to the Inputs parameter of this expert advisor.
Save symbols set from Market Watch


Share it with friends: