Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Basket Viewer - View statistics for long and short pairs - MetaTrader 5 Script - MT4/MT5 Resource

author EAcpu | 5 reads | 0 comments |

Basket Viewer-View Statistics on groups of Long and Short Pairs - indicator for MetaTrader 5

Basket Viewer-View Statistics on groups of Long and Short Pairs - indicator for MetaTrader 5

This utility allows monitoring of multiple symbols and positions on one chart, with one group for long (buy) symbols and another for short (sell) symbols. There are 7 default symbol pairs in each group. Users can change these and enter up to 50 Market Watch symbols in the long or short basket for viewing.

Click on a symbol to change the currently displayed chart to any symbol in the indicator display. Displays statistics including ATR, points gained or lost since the start of the week, position gains or losses, and lot exposure. Statistical weeks can be changed with a simple click on the display, and the display can be dragged and dropped to a different location.

Simply publishing an event that starts display update processing, rather than running the update inline with quote processing, keeps the load on quote processing low. Additionally, the display is updated at least once every second even if no quotes are received on the current chart.

 Below is a description of the display's main controls and functions - the first two lines have "Control Objects" (full image below):

Basket Viewer-View Statistics on groups of Long and Short Pairs - indicator for MetaTrader 5

"Shopping cart viewers (week 0): 2019.07.14 - 2019.07.21"

"Buy Basket    integral    Term_ATR    Positional parameters     Pos_lots", or "Purchase Basket    integral    India_ATR      Positional parameters     Pos_lots"

Click this line to highlight the currently selected week on the chart (draw a rectangle over it). Click a second time to delete the rectangle.

As shown in the image below, this title is followed by buy pair statistics, including totals for the "Points", "ATR", "Prft" and "Lots" columns.

"Sell_basket    integral    Term_ATR    Positional parameters    Pos_Lots", or "Sell_Basket    integral    India_ATR      Positional parameters    Pos_Lots"

This is a repeat of the "Buy Basket" title of the "Sell Basket". Click this row to change how ATR is calculated , either by using the iATR handle to get data from the terminal, or by using the iHigh and iLow functions to calculate itself. As shown in the image below, this title is followed by sell pair statistics, including totals for the "Points", "ATR", "Prft" and "Lots" columns. Totals are the opposite of buy baskets - for example, profit points for the week are (opening price - current/closing prices), while profit points for a buy basket are (current/closing prices - open prices).

Clicking on any "symbol pair" will change the chart to that symbol pair.

Basket Viewer-View Statistics on groups of Long and Short Pairs - indicator for MetaTrader 5

When the terminal is not ready to provide quote information, a large number of error messages are logged in the indicator. I recommend getting and uncommenting "#include // errordescription.mqh is found at: https://www.mql5.com/en/code/79", then search for ErrorDescription and use it to edit the line to include the error description. These functions have been commented out to make the code pass the automated tests required for release - I don't know of any other good way to get an error description.

The line (line 390) "USE_TERMINAL_ATR = ON;" can be edited to "USE_TERMINAL_ATR = OFF;" ATR is calculated internally by the indicator by default - I chose not to do this because the startup and initialization of the indicator terminal data seems to work better with the value ON. The terminal seems to take some time to prepare the values ​​for iOpen, iClose, iHigh and iLow. If running in the strategy tester, please be patient, the terminal may take some time to initialize before starting execution.


Attachment download

📎 basket_viewer.mq5 (132.87 KB)

Source: MQL5 #26118

Verification code Refresh