[MT4指标]每日支撑位和阻力位显示
主图指标
mt4指标类型:震荡指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| Daily Support and Resistance Special |
//| DSRS.mq4 |
//| Developed by mqldev |
//| http://www.mqldev.com |
//+------------------------------------------------------------------+
#property link "http://www.mqldev.com"
#property indicator_chart_window
extern color ResistanceColor = Red;
extern color SupportColor = Blue;
int init()
{
DelObjs();
return(0);
}
int deinit()
{
DelObjs();
return(0);
}
void start()
{
double c = iClose(NULL,PERIOD_D1,1);
double o = iOpen(NULL,PERIOD_D1,1);
double h = iHigh(NULL,PERIOD_D1,1);
double l = iLow(NULL,PERIOD_D1,1);
Print("close:",c," open:",o," high:",h," low:",l);
if (c>=o)
{
DrawLine(h,"Resistance",ResistanceColor);
DrawLine(o,"Support",SupportColor);
}
else
{
DrawLine(o,"Resistance",ResistanceColor);
DrawLine(l,"Support",SupportColor);
}
return(0);
}
int DrawLine(double price , string Obj , color clr)
{
int objs = ObjectsTotal();
string name;
for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
{
name=ObjectName(cnt);
if (StringFind(name,Obj,0)>-1)
{
ObjectMove(Obj,0,Time[0],price);
ObjectsRedraw();
return(1);
}
}
ObjectCreate(Obj,OBJ_HLINE,0,0,price);
ObjectSet(Obj,OBJPROP_COLOR,clr);
WindowRedraw();
return(0);
}
void DelObjs()
{
int objs = ObjectsTotal();
string name;
for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
{
name=ObjectName(cnt);
if (StringFind(name,"L",0)>-1) ObjectDelete(name);
WindowRedraw();
}
}
DSRS.jpg
