//+------------------------------------------------------------------+
//| tjd.mq4 |
//| Copyright ?2005, daxiooong | tjd.mq4 |
//| qq:123991669 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005,daxiooong."
//----
#property indicator_chart_window
//----
extern int Nzi=50;
extern int timeframe=0;
extern color color_all=Red;
extern int 顶底差=20;
extern int TP=82;
extern bool ALERTT=true;
extern bool TREND=true;
extern bool TRIANGLE=true;
extern bool 止损止盈=false;
extern bool FT=false; //false true
extern int WidthX=1;
extern int 点值=10;
//----
color color_all22 ;
int time0;
int num=0;
int MB=1;
string error="D1.";
double jilu;
int duan_0_5,duan_5_10,duan_02,duan_03,duan_06,duan_07;
double High_20,High_60,Close_00,High_All,Low_All,High_F,High_S,Low_Allx1,Low_Allx2,High_All_120p;
double 当天高点,High_127,Low_06,Low_255;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
if(Period()==43200){time0=2592000;}
else if(Period()==10080){time0=604800;}
else if(Period()==1440){time0=86400;}
else if(Period()==240){time0=14400;}
else if(Period()==60){time0=3600;}
else if(Period()==30){time0=1800;}
else if(Period()==15){time0=900;}
else if(Period()==5){time0=300;}
else if(Period()==1){time0=60;}
else return(0);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
ObjDel();
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i,ii;
//ObjDel();
//num=0;
//----
//----
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars-2;
//i=0;
for(i=limit; i>0; i--)
////////第一步 算出 最近的高点
if(
Open[i+1]Close[i+2]
&& Low[iLowest(NULL,timeframe,MODE_LOW,4,i+1)]=low_2 )
{
double high_3=High[iHighest(NULL,timeframe,MODE_HIGH,Nzi,time_l2+1)];
int time_h3=iHighest(NULL,timeframe,MODE_HIGH,Nzi,time_l2+1);
if( High[iHighest(NULL,timeframe,MODE_HIGH,5,time_h3+1)]low_05down && low_4=low_4
&& low_25 && (time_h3-time_l2)>5 && (time_l2-high_1)>5 && (time_h1-time_l0)>5
&& (iLowest(NULL,timeframe,MODE_LOW,Nzi,time_h3+1)-iHighest(NULL,timeframe,MODE_HIGH,Nzi,time_l2+1))>5
&& low_2High[iHighest(NULL,timeframe,MODE_HIGH,(time_l4-time_h3),time_h3+1)]
)
{
if(ALERTT==true)
{if(Close[i+1]==Close[1] && Open[i+1]==Open[1] && jilu!=Close[1] )
{jilu=Close[1];
Alert(Period()," 头肩底", Close[1],"!!!");}
}
if(TREND==true)
{
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TREND,0,Time[time_l0],low_0,Time[time_l4],low_4 );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, WidthX);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_STYLE, 2);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, FT);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, color_all);
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TREND,0,Time[time_l4],low_4,Time[time_h1],high_1 );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, WidthX);
//ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_STYLE, 2);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, FT);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, color_all);
}
if(TRIANGLE==true)
{
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TRIANGLE,0,Time[i],low_0,Time[time_h1],high_1 ,Time[time_l2],low_2 );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 1);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_STYLE, 2);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, color_all);
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TRIANGLE,0,Time[time_h3],high_3,Time[time_h1],high_1 ,Time[time_l2],low_2 );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 1);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_STYLE, 2);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, color_all);
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TRIANGLE,0,Time[time_h3],high_3,Time[time_l4],low_4 ,Time[time_l2],low_2 );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 1);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_STYLE, 2);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, color_all);
if( ((high_3-low_4)>(low_4-low_2)*3 || (high_1-low_4)>(low_4-low_2)*2 ) //底太小
//&& high_2((high_3+low_2)/2-Low[iLowest(NULL,timeframe,MODE_LOW,255,time_l4+1)])
&& ( high_1(high_3-low_4)*3 ) /// 1:3
)
{
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TRIANGLE,0,Time[i],Open[i],Time[i+7],Open[i]+30*点值*Point ,Time[i],Open[i]+30*点值*Point );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, WidthX);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, DarkOrange);
}
else
{
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TRIANGLE,0,Time[i],Open[i],Time[i+3],Open[i]-30*点值*Point ,Time[i],Open[i]-30*点值*Point );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, WidthX);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, color_all);
}
}
if(止损止盈==true)
{
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TREND,0,Time[i],Open[i]+TP*点值*Point,Time[i]+100*30,Open[i]+TP*点值*Point );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 1);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, White);
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TREND,0,Time[i],Open[i]+25*点值*Point,Time[i]+100*30,Open[i]+25*点值*Point );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 1);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, White);
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TREND,0,Time[i],Open[i]+45*点值*Point,Time[i]+100*30,Open[i]+45*点值*Point );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 3);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, White);
num++;
ObjectCreate("头肩底"+Nzi+"_"+num,OBJ_TREND,0,Time[i],Open[i]-20*点值*Point,Time[i]+100*50,Open[i]-20*点值*Point );
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_WIDTH, 3);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_RAY, false);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_BACK, true);
ObjectSet("头肩底"+Nzi+"_"+num, OBJPROP_COLOR, Red);
}
}
}
}
}
}
return(0);
}
//+------------------------------------------------------------------+
void ObjDel()
{
for(;num>=0;num--)
ObjectDelete("头肩底"+Nzi+"_"+num);
} |