accountdetails

Download script
Author: Iggy
accountdetails

This script is designed as a diagnostic tool for MetaTrader users who need a comprehensive, instantaneous snapshot of their trading environment. Instead of navigating through multiple menus to find specific data points, this tool gathers all essential information into a single, easy-to-read pop-up window.

The logic functions in three primary stages:

1. Account Environment Detection The script begins by analyzing your trading permissions and account status. It checks whether the current account is permitted to execute trades (returning a simple "Yes" or "No"). It also identifies how your "Stop Out" levels are calculated, ensuring that the percentage displayed accurately reflects your broker's specific rules.

2. Data Aggregation The tool then pulls two distinct categories of information from the trading platform:

  • General Account Overview: This includes high-level administrative details such as your unique account number, account name, the currency used for your balance, and the specific server you are connected to. It also retrieves your current financial standing, including your total Balance, Equity (the actual value of your open positions), Margin, and Free Margin.
  • Specific Symbol Dynamics: The script looks at the specific asset (e.g., EURUSD, Gold, etc.) currently on your chart. It gathers technical trading parameters such as the minimum and maximum lot sizes allowed, the "lot step" (how much you can increase a position by), tick values, current spreads, and swap rates for both long and short positions.

3. User Presentation Once all this data is collected from the background systems, the script compiles it into a formatted list. It then triggers a "Message Box"—a clear pop-up window—on your screen. This allows you to see your account health and the technical specifications of your current instrument at a glance, making it an efficient way to verify trading conditions before placing a trade.

Miscellaneous
It opens Message Boxes to the user
12 Views
0 Downloads
0 Favorites
accountdetails
//+------------------------------------------------------------------+
//|                                               accountdetails.mq4 |
//|                                           Copyright © 2006, Iggy |
//|                                                 irusoh@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Iggy"
#property link      "irusoh@yahoo.com"
//----
#include <WinUser32.mqh>
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
		 string stm,ta;
   int nTradeAllowed;
   if(AccountStopoutMode() == 0)
		     stm = "%";
   nTradeAllowed = MarketInfo(Symbol(), MODE_TRADEALLOWED);
		 switch(nTradeAllowed)
		   {
			    case 0:	ta = "No";	 break;
			    case 1:	ta = "Yes";	break;
		   }
		 string msg = "Account Details:" + "\n" +
		              "  Number\t\t" + AccountNumber() + "\n" +
		              "  Name\t\t" + AccountName() + "\n" +
		              "  Currency\t" + AccountCurrency() + "\n" +
		              "  Company\t" + AccountCompany() + "\n" +
		              "  Server\t\t" + AccountServer() + "\n" +
   	            "  Leverage\t" + AccountLeverage() + "\n" +
		              "  Stop Out level\t" + AccountStopoutLevel() + stm + "\n" +
		              "  Balance Details:" + "\n" +
		              "  Balance\t\t" + DoubleToStr(AccountBalance(), 4) + "\n" +
		              "  Equity\t\t" + DoubleToStr(AccountEquity(), 4) + "\n" +
		              "  Margin\t\t" + DoubleToStr(AccountMargin(), 4) + "\n" +
		              "  Free Margin\t" + DoubleToStr(AccountFreeMargin(), 4) + "\n" +
		              "  Symbol Details:" + "\n" +
		              "  Symbol\t\t" + Symbol() + "\n" +
 	              "  Lot Size\t\t" + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE),0) + 
 	              "\n" +
 	              "  Min Lot\t\t" + DoubleToStr(MarketInfo(Symbol(), MODE_MINLOT), 2) + 
 	              "\n" +
 	              "  Lot Step\t\t" + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSTEP), 2) + 
 	              "\n" +
 	              "  Max Lot\t\t" + DoubleToStr(MarketInfo(Symbol(), MODE_MAXLOT), 2) + 
 	              "\n" +
 	              "  Tick Value\t" + DoubleToStr(MarketInfo(Symbol(), MODE_TICKVALUE), 4) + 
 	              "\n" +
 	              "  Tick Size\t" + DoubleToStr(MarketInfo(Symbol(), MODE_TICKSIZE), Digits) + 
 	              "\n"+
 	              "  Spread\t\t" + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0) + 
 	              "\n" +
 	              "  Stop Loss Level\t" + DoubleToStr(MarketInfo(Symbol(), MODE_STOPLEVEL), 0) +
 	              "\n"+
 	              "  Swap Long\t" + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPLONG), 4) + 
 	              "\n" +
 	              "  Swap Short\t" + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPSHORT), 4) + 
 	              "\n" +
 	              "  Initial Margin\t" + DoubleToStr(MarketInfo(Symbol(), MODE_MARGININIT), 4) +
 	              "\n" +
 	              "  Maint Margin\t" + DoubleToStr(MarketInfo(Symbol(), MODE_MARGINMAINTENANCE),
 	              4) + "\n" +
 	              "  Required Margin\t" + DoubleToStr(MarketInfo(Symbol(), MODE_MARGINREQUIRED),
 	              4) + "\n" +
 	              "  Trade Allowed\t" + ta + "\n";
	  MessageBox(msg, "Account/Symbol Details", 0);  
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments