input bool Molot=0; // молот
input bool Harami=1; // харами
input bool Povesili=0; // повешенный
input bool Pogloshenie=0; // поглощение
input bool Mail=1;
input bool Push=1;
input bool Text=1;
input bool Arrow=1;
input bool Alerts=1;
//+------------------------------------------------------------------+
//| Korobka.mq5 |
//| Copyright 2019, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, AM2"
#property link "http://www.forexsyatems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_plots 0
input int Chas=12;
input int Chasov=70;
input color Clr=Blue;
MqlDateTime tm;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
Comment("");
ObjectsDeleteAll(0,0,OBJ_RECTANGLE);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutRect(string name,datetime t1,double p1,datetime t2,double p2,color clr)
{
ObjectDelete(0,name);
//--- создадим прямоугольник по заданным координатам
ObjectCreate(0,name,OBJ_RECTANGLE,0,t1,p1,t2,p2);
//--- установим цвет прямоугольника
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int TimeDayOfWeek(datetime date)
{
TimeToStruct(date,tm);
return(tm.day_of_week);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int TimeHour(datetime date)
{
TimeToStruct(date,tm);
return(tm.hour);
}
//+------------------------------------------------------------------+
//| 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[])
{
//---
datetime t=0;
for(int i=0; i<1111; i++)
{
t=iTime(NULL,0,i);
if(TimeDayOfWeek(t)==1 && TimeHour(t)==Chas)
PutRect("Session"+(string)i,t,iClose(NULL,0,i),t+Chasov*3600,iClose(NULL,0,i+Chasov),Clr);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Korobka.mq4 |
//| Copyright 2019, AM2 |
//| http://www.forexsyatems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, AM2"
#property link "http://www.forexsyatems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
input int Chasov=70;
input int Chas=12;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
Comment("");
ObjectsDeleteAll(0,0,OBJ_RECTANGLE);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutRect(string name,datetime t1,double p1,datetime t2,double p2,color clr)
{
ObjectDelete(0,name);
//--- создадим прямоугольник по заданным координатам
ObjectCreate(0,name,OBJ_RECTANGLE,0,t1,p1,t2,p2);
//--- установим цвет прямоугольника
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
}
//+------------------------------------------------------------------+
//| 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[])
{
//---
for(int i=1111; i>0; i--)
{
if(TimeDayOfWeek(time[i])==1 && TimeHour(time[i])==Chas) PutRect("Session"+(string)i,time[i],close[i],time[i]+Chasov*3600,close[i+Chasov],Blue);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
AM2