Где то делал я подобный. В базе гляньте: www.opentraders.ru/downloads/
Если не найдете напишу по ТЗ.
//+------------------------------------------------------------------+
//| HighLow.mq4 |
//| Copyright 2015, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
input int BarsCount=100;
//--- buffers
double UpBuf[];
double DnBuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
IndicatorBuffers(2);
SetIndexBuffer(0,UpBuf);
SetIndexBuffer(1,DnBuf);
//--- indicator line
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(0,108);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(1,108);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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=0; i<BarsCount; i++)
{
if(High[i+2]>High[i+1] && High[i]>High[i+1])
{
UpBuf[i]=Low[i];
}
if(Low[i+2]<Low[i+1] && Low[i]<Low[i+1])
{
DnBuf[i]=High[i];
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
AM2