+Market_Info

Download script
Author: Copyright � 2009, MetaQuotes Software Corp.
+Market_Info

This tool is designed to provide traders with a comprehensive, real-time dashboard of critical account and market data directly on their trading chart. Instead of forcing you to navigate through multiple menus to find specific numbers, it aggregates essential financial information into a single, easy-to-read summary.

Here is a breakdown of the logic used to generate this information:

Live Trading Statistics

The script automatically calculates your current floating profit by scanning all open positions on your account. It specifically looks for trades matching the current currency pair and aggregates the profit, including overnight swaps and trading commissions, giving you an accurate net figure of your current standing.

Dynamic Cost Calculations

One of the core features of this tool is its ability to translate raw market data into meaningful values based on your specific trade size (lot size). It calculates:

  • Tick Value: Shows exactly how much money is gained or lost per price movement for your specific lot size.
  • Spread & Costs: Displays the current spread in pips and converts it into a monetary value, helping you understand the immediate cost of entering a trade.
  • Swap Rates: Calculates the expected overnight interest (long and short) based on your position size.

Broker & Margin Requirements

To help with risk management, the tool pulls "hard" data from the broker's server, including:

  • Margin & Maintenance: It calculates how much collateral is required to keep your positions open based on your current lot size.
  • Trading Limits: It displays the minimum allowable lot size and your account's current leverage.
  • Safety Levels: It identifies the "Stop Level" and "Freeze Level," which are the boundaries set by the broker regarding how close to the price you can place orders.

Market Context & Session Awareness

The tool also provides a "big picture" view of the market environment:

  • Session Timing: It automatically detects the start and end times of the current trading session by analyzing recent price candle data.
  • Market Status: It checks whether the market is currently active or closed and displays this status clearly on your screen.

By consolidating these variables, the tool allows you to monitor your risk, costs, and account health at a glance without ever leaving your active chart.

Orders Execution
Checks for the total of open orders
8 Views
0 Downloads
0 Favorites
+Market_Info
//+------------------------------------------------------------------+
//|                                                 +Market_Info.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#property indicator_chart_window
extern double lot=0.1;
int to,tc;double mno=1;string val;
//+------------------------------------------------------------------+
void deinit(){Comment(" ");return;}
//+------------------------------------------------------------------+
void start(){
   val=AccountCurrency();
   if(Digits==3||Digits==5){mno=0.1;}else{mno=1;}
   for(int i=0;i<25;i++){if(Time[i]-Time[i+1]>Period()*60){to=Time[i];tc=Time[i+1];break;}}
   double profit;
   for(i=0;i<OrdersTotal();i++){
     if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
       if(OrderSymbol()==Symbol()){
         profit=profit+OrderProfit()+OrderSwap()+OrderCommission();
       }
     }
   }
   if(MarketInfo(Symbol(),MODE_TRADEALLOWED)==0){
     string makt = "Market Close";
   }else{
     makt = "Market Open";
   }
   Comment("For present lot = ",lot,"\n",
           "Tick value = ",MarketInfo(Symbol(),MODE_TICKVALUE)*lot*mno,"  ",val,"\n",
           "Spread = ",MarketInfo(Symbol(),MODE_SPREAD)*mno," pips  ",MarketInfo(Symbol(),MODE_SPREAD)*MarketInfo(Symbol(),MODE_TICKVALUE)*lot*mno,"  ",val,"\n",
           "Stoplewel = ",MarketInfo(Symbol(),MODE_STOPLEVEL)*mno," pips  ",MarketInfo(Symbol(),MODE_STOPLEVEL)*MarketInfo(Symbol(),MODE_TICKVALUE)*lot*mno,"  ",val,"\n",
           "Freezlewel = ",MarketInfo(Symbol(),MODE_FREEZELEVEL)*mno,"\n",
           "Swaplong = ",MarketInfo(Symbol(),MODE_SWAPLONG)*lot*mno,"  ",val,"\n",
           "SwapShort = ",MarketInfo(Symbol(),MODE_SWAPSHORT)*lot*mno,"  ",val
           ,"\nLeverage = ",AccountLeverage()
           ,"\nMargin = ",MarketInfo(Symbol(),MODE_MARGINREQUIRED)*lot*mno,"  ",val
           ,"\nMargin = ",MarketInfo(Symbol(),MODE_MARGINMAINTENANCE)*lot*mno,"  ",val
           ,"\nStartSession = ",TimeToStr(to,TIME_MINUTES)
           ,"\nEndSession = ",TimeToStr(tc,TIME_MINUTES)
           ,"\nMin Lot = ",MarketInfo(Symbol(),MODE_MINLOT)
           ,"\nProfit = ",profit,"  ",val
           ,"\n",makt 
           );

return;}

Comments