Navigation:Home > Content >

Profit_Indicator~.mq4

Time: 2018-08-03 | Download file:Profit_Indicator~.mq4

//+------------------------------------------------------------------+
//|                                             Profit_indicator.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
extern bool mini = false;          // Размер
extern int vertikal = 260;         // Перемещение по вертикали (в пикселах от верха)
extern int gorizont = 880;         // Перемещение по горизонтали (в пикселах от левого края)
extern color zag = DeepSkyBlue;    // Цвет заголовка
extern color raz = Red;            // Цвет разделителей
extern color dan = Gold;           // Цвет данных
extern color bal = MediumSeaGreen; // Цвет баланса
int ord;
//+------------------------------------------------------------------+
int razm1,razm2,razm3,vert1,vert2,vert3,vert4,vert5,vert6;
//+------------------------------------------------------------------+
int start(){
if(ord!=OrdersTotal())init();
return(0);}
//+------------------------------------------------------------------+
int init()
{
ord=OrdersTotal();
if(mini){razm1=13;razm2=12;razm3=10;vert1=13;vert2=28;vert3=44;vert4=60;vert5=69;vert6=81;}
else {razm1=17;razm2=14;razm3=13;vert1=17;vert2=42;vert3=68;vert4=94;vert5=106;vert6=126;}
//+------------------------------------------------------------------+
double de=0; string zd="";
double ne=0; string zn="";
double me=0; string zm="";
//+--------------------------------------------------------------------------------------------+
int seg=Seconds()+(Minute()*60)+(Hour()*3600);                                          // Количество секунд с начала дня
int den=TimeCurrent()-seg;                                                              // Время в секундах на начало дня
if(DayOfWeek()==0){int ned=den;}else {ned=TimeCurrent()-(((DayOfWeek()-1)*86400)+seg);} // Время в секундах на начало недели
int mes=TimeCurrent()-((Day()-1)*86400+seg);                                            // Время в секундах на начало месяца
//+------------------------------------------------------------------+
for(int i=0;i1)continue;
int OCT=OrderCloseTime();
if(OCTned)ne=ne+OP;
if(OCT>den)de=de+OP;
}
string d=DoubleToStr(de,2);
string n=DoubleToStr(ne,2);
string m=DoubleToStr(me,2);
if(de>0)zd="+";
if(ne>0)zn="+";
if(me>0)zm="+";
string prd=DoubleToStr(de/((AccountBalance()-de)/100),2);
string prn=DoubleToStr(ne/((AccountBalance()-ne)/100),2);
string prm=DoubleToStr(me/((AccountBalance()-me)/100),2);
//+--------------------------------------------------------------------------------------------+
ObjectCreate("profit1",OBJ_LABEL,0,0,0);
ObjectSet("profit1",OBJPROP_CORNER,0);
ObjectSet("profit1",OBJPROP_XDISTANCE,gorizont+75);  
ObjectSet("profit1",OBJPROP_YDISTANCE,vertikal);
ObjectSetText("profit1","Прибыль",razm1,"Times New Roman",zag);
//+------------------------------------------------------------------+
ObjectCreate("profit2",OBJ_LABEL,0,0,0);
ObjectSet("profit2",OBJPROP_CORNER,0);
ObjectSet("profit2",OBJPROP_XDISTANCE,gorizont+1);  
ObjectSet("profit2",OBJPROP_YDISTANCE,vertikal+vert1);
ObjectSetText("profit2","---------------------------------",razm1,"Times New Roman",raz);
//+------------------------------------------------------------------+
ObjectCreate("profit3",OBJ_LABEL,0,0,0);
ObjectSet("profit3",OBJPROP_CORNER,0);
ObjectSet("profit3",OBJPROP_XDISTANCE,gorizont+10);  
ObjectSet("profit3",OBJPROP_YDISTANCE,vertikal+vert2);
ObjectSetText("profit3","Сегодня :  "+zd+d+" $  ( "+zd+prd+" % )",razm3,"Times New Roman",dan);
//+------------------------------------------------------------------+
ObjectCreate("profit4",OBJ_LABEL,0,0,0);
ObjectSet("profit4",OBJPROP_CORNER,0);
ObjectSet("profit4",OBJPROP_XDISTANCE,gorizont+10);  
ObjectSet("profit4",OBJPROP_YDISTANCE,vertikal+vert3);
ObjectSetText("profit4","Неделя   :  "+zn+n+" $  ( "+zn+prn+" % )",razm3,"Times New Roman",dan);
//+------------------------------------------------------------------+
ObjectCreate("profit5",OBJ_LABEL,0,0,0);
ObjectSet("profit5",OBJPROP_CORNER,0);
ObjectSet("profit5",OBJPROP_XDISTANCE,gorizont+10);  
ObjectSet("profit5",OBJPROP_YDISTANCE,vertikal+vert4);
ObjectSetText("profit5","Месяц    :  "+zm+m+" $  ( "+zm+prm+" % )",razm3,"Times New Roman",dan);
//+------------------------------------------------------------------+
ObjectCreate("profit6",OBJ_LABEL,0,0,0);
ObjectSet("profit6",OBJPROP_CORNER,0);
ObjectSet("profit6",OBJPROP_XDISTANCE,gorizont+1);  
ObjectSet("profit6",OBJPROP_YDISTANCE,vertikal+vert5);
ObjectSetText("profit6","---------------------------------",razm1,"Times New Roman",raz);
//+------------------------------------------------------------------+
string b=DoubleToStr(AccountBalance(),2);
ObjectCreate("profit7",OBJ_LABEL,0,0,0);
ObjectSet("profit7",OBJPROP_CORNER,0);
ObjectSet("profit7",OBJPROP_XDISTANCE,gorizont+22);  
ObjectSet("profit7",OBJPROP_YDISTANCE,vertikal+vert6);
ObjectSetText("profit7","Баланс : "+b+" $",razm2,"Times New Roman",bal);
//+------------------------------------------------------------------+*/
WindowRedraw();
return(0);}
//+-----------------------------------------------------------------------------------------------------------------------+*/
void deinit(){
ObjectDelete("profit1");
ObjectDelete("profit2");
ObjectDelete("profit3");
ObjectDelete("profit4");
ObjectDelete("profit5");
ObjectDelete("profit6");
ObjectDelete("profit7");
return;}

Recommend