Author: Copyright � 2007, syanwar (www.viking234.com)
MarketInfo

This script functions as a comprehensive diagnostic dashboard for MetaTrader 4, designed to provide traders with an immediate and detailed overview of their trading environment. Rather than performing automated trades or generating complex mathematical signals, its primary purpose is transparency: it gathers and displays critical "under-the-hood" data from both the user's account and the specific financial instrument being viewed.

Core Functionality

The logic follows a structured process to gather information in real-time:

1. Account Identity & Environment The script first identifies the fundamental details of your trading session. It retrieves and displays your current leverage, unique account number, account name, the hosting company's name, and the specific server you are connected to. This ensures the trader knows exactly which environment they are operating in.

2. Market Mechanics & Constraints The script then pulls a wide array of technical specifications for the currency pair or asset on your chart. These include:

  • Precision & Sizing: It identifies the "point size" (the smallest price change), the number of decimal places, and the minimum/maximum lot sizes allowed by the broker.
  • Cost Analysis: It calculates the current spread (the difference between the buy and sell price) and the tick value (how much money is gained or lost per price movement).
  • Trading Rules: It displays "Stop Levels" (the buffer zone for placing orders), "Lot Steps" (the increments allowed when resizing positions), and whether trading is currently permitted on that specific symbol.

3. Margin & Overnight Costs To help with risk management, the script extracts deep-level data regarding costs:

  • Swap Rates: It reveals the rollover fees for holding positions overnight, specifically showing the rates for both long and short positions.
  • Margin Requirements: It identifies how much collateral is required to open a position, including initial margin, maintenance margin, and hedged margin requirements. This allows traders to see exactly how much "free" capital is needed based on the broker's specific rules.

User Experience

Instead of appearing as a complex graph or an intrusive popup, the script utilizes the "Comment" feature of the platform. All gathered information is compiled into a clean, organized text list that appears directly on your trading chart. This allows for a quick glance to verify market conditions and account status without having to navigate through multiple sub-menus in the platform's settings.

8 Views
0 Downloads
0 Favorites
MarketInfo
//+------------------------------------------------------------------+
//|                                                   BinuJoshep.mq4 |
//|                    Copyright © 2007, syanwar (www.viking234.com) |
//|                                              admin@viking234.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, syanwar (www.viking234.com)"
#property link      "admin@viking234.biz"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
//---- indicators
double MPoint  = MarketInfo(Symbol(), MODE_POINT); // Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point 
double MTickva = MarketInfo(Symbol(), MODE_TICKVALUE); // Tick value in the deposit currency. 
double MTicksa = MarketInfo(Symbol(), MODE_TICKSIZE); // Tick size in points. 
double MSpread = MarketInfo(Symbol(), MODE_SPREAD); // Spread value in points. 
double MMinlot = MarketInfo(Symbol(), MODE_MINLOT); // Minimum permitted amount of a lot. 
double MMaxlot = MarketInfo(Symbol(), MODE_MAXLOT); // Maximum permitted amount of a lot. 
double MLotste = MarketInfo(Symbol(), MODE_LOTSTEP); // Step for changing lots. 
double MStopLe = MarketInfo(Symbol(), MODE_STOPLEVEL); // Stop level in points. 
double MLotsiz = MarketInfo(Symbol(), MODE_LOTSIZE); // Lot size in the base currency. 
double MSwapty = MarketInfo(Symbol(), MODE_SWAPTYPE); // Swap calculation method. 0 - in points; 1 - in the symbol base currency; 2 - by interest; 3 - in the margin currency. 
double MSwaplo = MarketInfo(Symbol(), MODE_SWAPLONG); // Swap of the long position. 
double MSwapsh = MarketInfo(Symbol(), MODE_SWAPSHORT); // Swap of the short position. 
double MStrati = MarketInfo(Symbol(), MODE_STARTING); // Market starting date (usually used for futures). 
double MExpira = MarketInfo(Symbol(), MODE_EXPIRATION); // Market expiration date (usually used for futures). 
double MTradea = MarketInfo(Symbol(), MODE_TRADEALLOWED); // Trade is allowed for the symbol. 
double MProcal = MarketInfo(Symbol(), MODE_PROFITCALCMODE); // Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures. 
double MDigits = MarketInfo(Symbol(), MODE_DIGITS); // Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits 
double MMarcal = MarketInfo(Symbol(), MODE_MARGINCALCMODE); // Margin calculation mode. 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices. 
double MMarini = MarketInfo(Symbol(), MODE_MARGININIT); // Initial margin requirements for 1 lot. 
double MMarman = MarketInfo(Symbol(), MODE_MARGINMAINTENANCE); // Margin to maintain open positions calculated for 1 lot. 
double MMarhed = MarketInfo(Symbol(), MODE_MARGINHEDGED); // Hedged margin calculated for 1 lot. 
double MMarreq = MarketInfo(Symbol(), MODE_MARGINREQUIRED); // Free margin required to open 1 lot for buying. 
double MFreezl = MarketInfo(Symbol(), MODE_FREEZELEVEL); // Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed. 

//----
Comment(
"ACCOUNT INFO\n- AccountLeverage: "+AccountLeverage()+
"\n- AccountNumber: "+AccountNumber()+
"\n- AccountName: "+AccountName()+
"\n- AccountCompany: "+AccountCompany()+
"\n- AccountServer: "+AccountServer()+
"\nMARKET INFO\n-= ", MPoint,  
" (Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point)\n-= ", MTickva, 
" (Tick value in the deposit currency)\n-= ", MTicksa, 
" (Tick size in points)\n-= ", MSpread, 
" (Spread value in points)\n-= ", MMinlot, 
" (Minimum permitted amount of a lot)\n-= ", MMaxlot, 
" (Maximum permitted amount of a lot)\n-= ", MLotste, 
" (Step for changing lots)\n-= ", MStopLe, 
" (Stop level in points)\n-= ", MLotsiz, 
" (Lot size in the base currency)\n-= ", MSwapty, 
" (Swap calculation method. 0 - in points; 1 - in the symbol base currency; 2 - by interest; 3 - in the margin currency)\n-= ", MSwaplo, 
" (Swap of the long position)\n-= ", MSwapsh, 
" (Swap of the short position)\n-= ", MStrati, 
" (Market starting date (usually used for futures))\n-= ", MExpira, 
" (Market expiration date (usually used for futures))\n-= ", MTradea, 
" (Trade is allowed for the symbol)\n-= ", MProcal, 
" (Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures)\n-= ", MDigits, 
" (Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits)\n-= ", MMarcal, 
" (Margin calculation mode. 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices)\n-= ", MMarini, 
" (Initial margin requirements for 1 lot)\n-= ", MMarman, 
" (Margin to maintain open positions calculated for 1 lot)\n-= ", MMarhed, 
" (Hedged margin calculated for 1 lot)\n-= ", MMarreq, 
" (Free margin required to open 1 lot for buying)\n-= ", MFreezl, 
" (Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed)");//----
//----

   return(0);
  }
//+------------------------------------------------------------------+

Comments