DUR Indicator
//+------------------------------------------------------------------+
//| PIVOT |
//| Darma |
//| http://darmasdt.com |
//+------------------------------------------------------------------+
#property copyright "Darma"
#property link "http://groups.yahoo.com/group/indotraders"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Goldenrod
#property indicator_color3 Blue
#property indicator_color4 Black
#property indicator_color5 Green
#property indicator_color6 Green
#property indicator_color7 Green
#property indicator_color8 Green
//---- input parameters
extern int change_day_hour=0;
extern bool HLCCper4=false;
extern bool HLCper3=false;
extern bool HLper2=false;
extern bool DailyOpen=true;
extern bool Sup_Res4=false;
extern bool Sup_Res3=false;
//---- buffers
double Pivot4[];
double Pivot3[];
double Pivot2[];
double Pivot1[];
double Res4[];
double Sup4[];
double Res3[];
double Sup3[];
//---- variables
int limit, cur_day, prev_day, barChangeDay;
double y_c,t_o,y_h,y_l,P4,P3,P2,R4,S4,R3,S3;
double day_high, day_low, dayHprev, dayLprev;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(0,Pivot4);
SetIndexStyle(1,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(1,Pivot3);
SetIndexStyle(2,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(2,Pivot2);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(3,Pivot1);
SetIndexStyle(4,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(4,Res4);
SetIndexStyle(5,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(5,Sup4);
SetIndexStyle(6,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(6,Res3);
SetIndexStyle(7,DRAW_LINE,STYLE_DASHDOTDOT,1);
SetIndexBuffer(7,Sup3);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
ObjectsRedraw();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=limit; i>=0; i--)
{
cur_day=TimeDay(Time);
if(
TimeHour(Time)==change_day_hour &&
TimeMinute(Time)==0
)
{
barChangeDay=i;
y_c=Close;
t_o=Open;
y_h=day_high;
y_l=day_low;
P4=(y_h + y_l + y_c + t_o)/4;
P3=(y_h + y_l + y_c)/3;
P2=(y_h + y_l)/2;
R4=P4 + (P4 - y_l);
R3=P3 + (P3 - y_l);
S4=P4 + (P4 - y_h);
S3=P3 + (P3 - y_h);
day_high=High;
day_low =Low;
} // if
dayHprev=day_high;
dayLprev=day_low;
day_high=MathMax(day_high, High);
day_low=MathMin(day_low, Low);
if (HLCCper4)
{
Pivot4=P4;
}
if (HLCper3)
{
Pivot3=P3;
}
if (HLper2)
{
Pivot2=P2;
}
if (DailyOpen)
{
Pivot1=t_o;
}
if (Sup_Res4)
{
Res4=R4;
Sup4=S4;
}
if (Sup_Res3)
{
Res3=R3;
Sup3=S3;
}
} // for
//---- done
return(0);
}
//+------------------------------------------------------------------+
学习了,谢谢分享、、、 帮帮顶顶!! 难得一见的好帖 真是 收益 匪浅 :lol不错 帮你顶下哈!! 帮你顶下哈!! 学习了,不错 谢谢楼主分享