Делал индикатор для анализа цены за указанный промежуток времени. ТФ М1-Н1.
Пробовал переделывать i-Sessions, не получил то что надо. Написал свой вариант.
Настройки:
extern int BarsCount = 500; // Количество баров
extern int HourTime = 5; // Часов в зоне
extern string EndTime = "2:00"; // Конец зоны
extern color RectColor = Blue; // Цвет
Вид с 21 до 2:00. ТФ Н1.
Вид с 21 до 2:00. ТФ М15.
Вид с 10 до 20:00. ТФ Н1.
Вид с 10 до 20:00. ТФ М5.
Код индикатора:
//+------------------------------------------------------------------+
//| PriceTime.mq4 |
//| Copyright 2016, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
//------- Внешние параметры индикатора ----------------------------------------+
extern int BarsCount = 500; // Количество баров
extern int HourTime = 5; // Часов в зоне
extern string EndTime = "2:00"; // Конец зоны
extern color RectColor = Blue; // Цвет
//+----------------------------------------------------------------------------+
//| Custom indicator initialization function |
//+----------------------------------------------------------------------------+
void init()
{
ObjectsDeleteAll(0,OBJ_RECTANGLE);
Comment("");
}
//+----------------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+----------------------------------------------------------------------------+
void deinit()
{
ObjectsDeleteAll(0,OBJ_RECTANGLE);
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void PutRect(string n,datetime t1,double p1,datetime t2,double p2)
{
ObjectCreate(0,n,OBJ_RECTANGLE,0,t1,p1,t2,p2);
ObjectSetInteger(0,n,OBJPROP_COLOR,RectColor);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Per()
{
int p=0;
if(Period()==60) p=24;
if(Period()==30) p=48;
if(Period()==15) p=96;
if(Period()==5) p=288;
if(Period()==1) p=1440;
return(p);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Count()
{
int c=0;
if(Period()==60) c=HourTime;
if(Period()==30) c=HourTime*2;
if(Period()==15) c=HourTime*4;
if(Period()==5) c=HourTime*12;
if(Period()==1) c=HourTime*60;
return©;
}
//+------------------------------------------------------------------+
//| 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[])
{
//---
int s=iBarShift(NULL,0,StringToTime(EndTime));
for(int i=s; i<BarsCount; i++)
{
double h=high[iHighest(NULL,0,MODE_HIGH,Count(),i)];
double l=low[iLowest(NULL,0,MODE_LOW,Count(),i)];
PutRect((string)time[i],time[i],h,time[i+Count()],l);
i=i+Per()-1;
}
/*
Comment("\n Shift: ",s,
"\n Period: ",Period(),
"\n Period2: ",Per());
*/
return(rates_total);
}
//+------------------------------------------------------------------+
Скачать:
www.opentraders.ru/downloads/1053/
Комментарии (8)
return©; надо заменить вместо копирайта на с в скобках.
19 pacak Сообщений: 552 - варвар Andre
Исправить можно только в течение часа после публикации. А так еще файлом есть.
35 AM2 Автор Сообщений: 16485 - Андрей
11 preasto Сообщений: 445
Индикатор визуальный. Я делал его чтобы смотреть как цена ведет себя в определенное время, допустим ночью.
35 AM2 Автор Сообщений: 16485 - Андрей
0 sforex58 Сообщений: 2
11 preasto Сообщений: 445
0 sforex58 Сообщений: 2
нахера козе баян?
10 cardon Сообщений: 376
Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий