Author: Copyright 2014, 101177ui@gmail.com
cek_op

This script is a visual management tool designed for the MetaTrader 4 platform. It serves two primary purposes: providing a real-time dashboard of your account's financial status and automatically marking trade entries, exits, and profit targets directly on your price chart.

Account Dashboard

When activated, the script displays a live text summary in the corner of your trading chart. This provides you with an instant snapshot of your account's health without needing to navigate away from your active trades. It tracks:

  • Balance & Equity: Your current available funds and the real-time value of your open positions.
  • Profit/Loss: The current floating profit or loss of your active trades.
  • Margin & Free Margin: Details on how much capital is currently locked in trades versus how much remains available for new positions.
  • Margin Level: A percentage indicating your account's liquidity and safety buffer.

Visual Trade Tracking

The core logic of this script is its ability to "draw" your trading history and current activity on the chart. It automatically identifies your trades based on the specific currency pair you are viewing and performs the following actions:

1. Active Trades (Live Monitoring) For every open position, the script places visual markers on the chart:

  • Entry Points: It marks where you entered a "Buy" or "Sell" order using colored arrows.
  • Profit Targets: It identifies your Take Profit levels, providing a clear visual goal for your current trade.

2. Historical Trade Analysis The script also scans your past trading history to recreate a visual map of your previous performance:

  • Execution Marks: It places specific markers at the exact price and time where previous trades were opened and closed.
  • Trend Lines: For completed trades, the script can draw dotted trend lines connecting the entry point to the exit point. This allows you to visually see the "path" of a trade, making it easier to analyze your historical performance and identify patterns in your trading behavior.

Summary for Users

Essentially, this tool acts as a visual diary and real-time monitor. It clears away the clutter by highlighting exactly where you got in and out of the market, while simultaneously keeping your most important financial statistics visible at all times. This helps traders stay organized, maintain a clear overview of their risk (margin), and better visualize their past successes and mistakes.

Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open ordersChecks for the total of closed orders
4 Views
0 Downloads
0 Favorites
cek_op
//+------------------------------------------------------------------+
//|                                                       cek OP.mq4 |
//|                               Copyright 2014, 101177ui@gmail.com |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, 101177ui@gmail.com"
#property link      "http://www.mql4.com"
#property indicator_chart_window

input bool Comment=true;//see comment

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   Comment("");
   return(INIT_SUCCEEDED);
  }
  
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   Comment("");
   ObjectsDeleteAll();
   return(0);
  }
  
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {double AM=AccountInfoDouble(ACCOUNT_MARGIN);
   if(AM==0)AM=Point;
   double ML=AccountInfoDouble(ACCOUNT_EQUITY)/AM*100;
   if(AM==0)ML=0;
   if(Comment)
      Comment("\n","ACCOUNT_BALANCE        =  ",AccountInfoDouble(ACCOUNT_BALANCE),
              "\n","ACCOUNT_PROFIT           =  ",AccountInfoDouble(ACCOUNT_PROFIT),
              "\n","ACCOUNT_EQUITY           =  ",AccountInfoDouble(ACCOUNT_EQUITY),
              "\n","ACCOUNT_MARGIN          =  ",AccountInfoDouble(ACCOUNT_MARGIN),
              "\n","ACCOUNT_FREEMARGIN  =  ",AccountInfoDouble(ACCOUNT_FREEMARGIN),
              "\n","MARGIN LEVEL                  =  ",ML," %"
              );
              
   string symbol=Symbol();
   int cntcb;
//+------------------------------------------------------------------+
//| gambar price aktual                                              |
//+------------------------------------------------------------------+
   
   for(cntcb=OrdersTotal(); cntcb>=0; cntcb--)
     {
      if(OrderSelect(cntcb,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==symbol)
           {
            string AN="BUY"+OrderOpenPrice()+TimeToStr(OrderOpenTime());
            if(OrderType()==0)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,OrderOpenTime(),OrderOpenPrice(),3,Blue);
            AN="TPBUY"+OrderOpenPrice()+OrderTakeProfit()+TimeToStr(OrderOpenTime());
            if(OrderType()==0)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,Time[0],+OrderTakeProfit(),3,White);
            AN="SELL"+OrderOpenPrice()+TimeToStr(OrderOpenTime());
            if(OrderType()==1)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,OrderOpenTime(),OrderOpenPrice(),3,Red);
            AN="TPSELL"+OrderOpenPrice()+OrderTakeProfit()+TimeToStr(OrderOpenTime());
            if(OrderType()==1)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,Time[0],+OrderTakeProfit(),3,Green);
           }
     }
//+------------------------------------------------------------------+
//| baca sejarah                                                     |
//+------------------------------------------------------------------+
   for(cntcb=0; cntcb<=OrdersHistoryTotal(); cntcb++)
     {
      if(OrderSelect(cntcb,SELECT_BY_POS,MODE_HISTORY))
         if(OrderSymbol()==symbol)
           {
            AN="BUY"+OrderOpenPrice()+TimeToStr(OrderOpenTime());
            ObjectDelete(AN);
            if(OrderType()==0)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,OrderOpenTime(),OrderOpenPrice(),1,Blue);
            AN="CloseBUY"+OrderClosePrice()+TimeToStr(OrderOpenTime());
            ObjectDelete(AN);
            if(OrderType()==0)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,OrderCloseTime(),OrderClosePrice(),11,White);
            AN="LCloseBUY"+OrderClosePrice()+TimeToStr(OrderOpenTime());
            ObjectDelete(AN);
            if(OrderType()==0)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  tren(AN,OrderOpenTime(),OrderOpenPrice(),OrderCloseTime(),OrderClosePrice(),5,Blue);
            AN="SELL"+OrderOpenPrice()+TimeToStr(OrderOpenTime());
            ObjectDelete(AN);
            if(OrderType()==1)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,OrderOpenTime(),OrderOpenPrice(),1,Red);
            AN="CloseSELL"+OrderClosePrice()+TimeToStr(OrderOpenTime());
            ObjectDelete(AN);
            if(OrderType()==1)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  gbr(AN,OrderCloseTime(),OrderClosePrice(),11,Aqua);

            AN="LCloseSELL"+OrderClosePrice()+TimeToStr(OrderOpenTime());
            ObjectDelete(AN);
            if(OrderType()==1)
               if(ObjectGet(AN,OBJPROP_PRICE1)==0)
                  tren(AN,OrderOpenTime(),OrderOpenPrice(),OrderCloseTime(),OrderClosePrice(),5,Red);
           }
     }
   return(0);
  }
//+------------------------------------------------------------------+
//| kode panah                                                       |
//+------------------------------------------------------------------+
void gbr(string nama,datetime tempat,double harga1,int kode,color warna)
  {
   if(kode==1)
     {
      ObjectCreate(nama,OBJ_ARROW,0,tempat,harga1);
      ObjectSet(nama,OBJPROP_ARROWCODE,1);
      ObjectSet(nama,OBJPROP_COLOR,warna);
     }
   if(kode==11)
     {
      ObjectCreate(nama,OBJ_ARROW,0,tempat,harga1);
      ObjectSet(nama,OBJPROP_ARROWCODE,3);
      ObjectSet(nama,OBJPROP_COLOR,warna);
     }
   if(kode==2)
     {
      ObjectCreate(nama,OBJ_ARROW,0,tempat,harga1);
      ObjectSet(nama,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
      ObjectSet(nama,OBJPROP_COLOR,warna);
      ObjectSet(nama,OBJPROP_PRICE1,harga1);
      ObjectSet(nama,OBJPROP_TIME1,tempat);
     }
   if(kode==3)
     {
      ObjectCreate(nama,OBJ_ARROW,0,tempat,harga1);
      ObjectSet(nama,OBJPROP_ARROWCODE,SYMBOL_LEFTPRICE);
      ObjectSet(nama,OBJPROP_COLOR,warna);
      ObjectSet(nama,OBJPROP_PRICE1,harga1);
      ObjectSet(nama,OBJPROP_TIME1,tempat);
     }
   if(kode==4)
     {
      ObjectCreate(nama,OBJ_HLINE,0,0,harga1);
      ObjectSet(nama,OBJPROP_COLOR,warna);
      ObjectSet(nama,OBJPROP_WIDTH,1);
      ObjectSet(nama,OBJPROP_RAY,False);
     }
   return;
  }//*/
//+------------------------------------------------------------------+
//| Gambar trenline                                                  |
//+------------------------------------------------------------------+
void tren(string nama,datetime tempat1,double harga1,datetime tempat2,double harga2,int kode,color warna)
  {
   if(kode==5)
     {
      ObjectCreate(nama,OBJ_TREND,0,tempat1,harga1,tempat2,harga2);
      ObjectSet(nama,6,warna);
      ObjectSet(nama,7,STYLE_DOT);
      ObjectSet(nama,10,0);
      ObjectSetText(nama,nama);
     }
   return;
  }

Comments