
//+------------------------------------------------------------------+
//| TickTak.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_separate_window
#property indicator_buffers 4
//--- indicator buffers
double up[];
double dn[];
double mi[];
double ma[];
int i=0;
double last=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexStyle(0,DRAW_HISTOGRAM,0,4,Blue);
SetIndexStyle(1,DRAW_HISTOGRAM,0,4,Red);
SetIndexStyle(2,DRAW_LINE,0,2,Lime);
SetIndexStyle(3,DRAW_NONE);
SetIndexBuffer(0,up);
SetIndexBuffer(1,dn);
SetIndexBuffer(2,mi);
SetIndexBuffer(3,ma);
last=Bid;
//---
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[])
{
//---
if(last!=Bid)
{
if(Bid-last>0)
{
up[i]=(Bid-last)/_Point;
ma[i]=up[i];
mi[i]=ma[i];
i++;
}
if(Bid-last<0)
{
dn[i]=(Bid-last)/_Point;
ma[i]=dn[i];
mi[i]=ma[i];
i++;
}
last=Bid;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Ну это когда спред прыгает вниз на большее количество пипсов чем вверх или наоборот за бар, час, день…
AM2