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.
Account Information Panel shows the following for you to take timely decisions:
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).
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.
Download History allows the export of the account history to a text file.
View closed trades for symbol on the chart.
|
|
| 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.
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 to open the Account Information panel and click on
to close it.
If Account Information is the Main panel then click on to open the P&L Calendar panel and click on
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
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 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.
Year view of your profits
Clicking on the 'Year' button will allow you to choose 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.
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 shows the current running profit or loss.
The Margin formatting can be customized by choosing the below options:
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 button on the Account Information Panel and
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.
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 icon highlights the current symbol of the chart. On clicking on
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 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 icon on the Symbols Panel and
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.
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.
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.
The indicator allows the configuration of the lines shown on the chart as below:
The available options for displaying the open trade lines on chart are:
- As Horizontal Lines » These are similar to the default lines shown by Metatrader wherein the lines extended on the left of the chart.
- Lines from open time » The lines will be drawn from the time when the trade was opened till the extreme right of the chart.
- Lines from open with background » In addition to the lines drawn from the trade open, a background with a specified transparency (opacity) will be displayed.
The bottom section on left of Open Trades 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.
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.
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 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 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.
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:
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 | Company where the Account has been opened |
![]() | Ticket No. | Ticket number for the trade |
![]() | Open Time | Time when trade was opened |
![]() | Trade Type | Type of Trade |
![]() | Symbol | Symbol for the trade |
![]() | Lot size | The Lot size |
![]() | Open Price | Price at which trade was opened |
![]() | Close Price | Price at which trade was closed |
![]() | Close Time | Time when trade was closed |
![]() | Points | Total points between close and open price |
![]() | Profit | Profit or Loss for the trade |
![]() | Swap Fees | Any commision, swap fees charged by Market Maker |
![]() | Net Profit | Net Profit or Loss for the trade |
![]() | 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 button to view closed trades for symbol on chart and on
to hide them. The displayed line is shown from the trade open to close time. A tooltip displays the information for each trade.
The styling of the line can be configured as below:
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
![]() | Configure the font style and size of text displayed on the panel. |
![]() | 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.
- Add the desired symbols to the Market Watch
- Right click the mouse on the symbols section to get a popup
- 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)
- Enter the name of the file to the Inputs parameter of this expert advisor.
