[MT4指标]DRP指标
主图指标
DRP指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| DRP.mq4 |
//| Yuriy Tokman |
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "[email protected]"
#property indicator_chart_window
extern color colir = Red;
extern int barsToProcess=1000;
int total=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
string name;
for(int i=0;;i++) {
name=StringConcatenate("drp",DoubleToStr(i,0));
if(!ObjectDelete(name)) break;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(),
per=Period()*60,
limit=0,
i=0;
string name;
datetime time=0;
limit=Bars-counted_bars;
if(limit>barsToProcess)
limit=barsToProcess;
i=limit-1;
while (i>=0)
{
double x=0.0,
h = iHigh(NULL,0,i),
l = iLow(NULL,0,i),
o = iOpen(NULL,0,i),
c = iClose(NULL,0,i);
if(co) x=(h+l+c+h)/2;
else if(c==o) x=(h+l)/2;
if(ObjectGet(StringConcatenate("drp",DoubleToStr(total-1,0)),
OBJPROP_TIME1)==Time[0]) {
ObjectSet(StringConcatenate("drp",DoubleToStr(total-1,0)),
OBJPROP_PRICE1,x-l);
ObjectSet(StringConcatenate("drp",DoubleToStr(total-1,0)),
OBJPROP_PRICE2,x-h);
break;
}
time=Time+per;
while(iBarShift(0,0,time,true)==-1 && time