//+------------------------------------------------------------------+
//| Procent2.mq4 |
//| Copyright 2019, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
input int x=88;
input int y=44;
input int corner=3;
input double procent=0;
input color fon=Black;
bool p=1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
ObjectDelete(0,"PRO");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Pro()
{
double pro=(AccountEquity()-AccountBalance())/AccountBalance()*100;//(1100-1000)/1000
return(pro);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutButton(string text)
{
ObjectDelete(0,"PRO");
ObjectCreate(0,"PRO",OBJ_BUTTON,0,0,0);
//--- установим координаты кнопки
ObjectSetInteger(0,"PRO",OBJPROP_XDISTANCE,x);
ObjectSetInteger(0,"PRO",OBJPROP_YDISTANCE,y);
//--- установим размер кнопки
ObjectSetInteger(0,"PRO",OBJPROP_XSIZE,50);
ObjectSetInteger(0,"PRO",OBJPROP_YSIZE,30);
//--- установим угол графика, относительно которого будут определяться координаты точки
ObjectSetInteger(0,"PRO",OBJPROP_CORNER,corner);
//--- установим текст
ObjectSetString(0,"PRO",OBJPROP_TEXT,text);
//--- установим шрифт текста
ObjectSetString(0,"PRO",OBJPROP_FONT,"Arial");
//--- установим размер шрифта
ObjectSetInteger(0,"PRO",OBJPROP_FONTSIZE,12);
//--- установим цвет текста
ObjectSetInteger(0,"PRO",OBJPROP_COLOR,Red);
//--- установим цвет фона
ObjectSetInteger(0,"PRO",OBJPROP_BGCOLOR,fon);
//--- установим цвет границы
ObjectSetInteger(0,"PRO",OBJPROP_BORDER_COLOR,White);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
PutButton((string)(NormalizeDouble(Pro(),2))+" %");
if(Pro()<procent)
p=1;
if(Pro()>procent && p)
{
Alert("Профит : "+(string)NormalizeDouble(Pro(),2)+" %");
p=0;
}
if(Pro()>0)
ObjectSetInteger(0,"PRO",OBJPROP_COLOR,Lime);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
1 место 7 $ sernazarov (14) -24.6 pip 2 место 5.4 $ igrecos (18) +28.3 pip 3 место 3 $ LLT79 (12) -36.3 pip 4 место 2 $ Faeton (13) -40.4 pip
Это было сказано на всесоюзной сессии ВАСХНИЛ в Политехническом музее на семинаре лекторов обкомов партии. Трофим Денисович заявил, что отрицание законов наследования стало стимулом для развития молодых ученых и для передовых исследований в сфере биологии.
Bishop