You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I got this "object name passed to ObjectType function cannot be an uninitialized or empty string
" error, and I've done my best to fix any possiblity....but failed. Please help me.
This is an indicator for trendline breakout alert. I guess error is about the LABEL "tpl".....but just guess.
//+------------------------------------------------------------------+ //| qsxyj.mq4 | //| Copyright ?2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property link "http://www.metaquotes.net" #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ extern bool allowsound=1; extern bool allowalertwindow=0; extern int timegap=5; extern int keeptexttime=15; extern int horizon=10; extern int veritical=10; extern int lineapart=20; extern int textfont=10; extern color textcolor=Orange; extern string linename="Tr"; int PrevAlertTime = 0; int Prevtext=0; double lastbreakprice=0; int init() { return(0); } int deinit() { if(ObjectFind("remind1")==0) ObjectDelete("remind1"); if(ObjectFind("tpl")==0) ObjectDelete("tpl"); if(ObjectFind("LINE1")==0) ObjectDelete("LINE1"); if(ObjectFind("LINE2")==0) ObjectDelete("LINE2"); if(ObjectFind("LINE3")==0) ObjectDelete("LINE3"); return(0); } //+------------------------------------------------------------------+ int start() { int i=ObjectsTotal(); int j,yjx=0; double price1,dh,dl; string name1; dh=iHigh(NULL,PERIOD_D1,0); dl=iLow(NULL,PERIOD_D1,0); ObjectCreate("LINE1",OBJ_LABEL,0,0,0); ObjectSet("LINE1", OBJPROP_XDISTANCE,horizon); ObjectSet("LINE1", OBJPROP_YDISTANCE,veritical+lineapart*0); ObjectSet("LINE1", OBJPROP_CORNER,1); ObjectSetText("LINE1","day amplitude "+DoubleToStr((dh-dl)/Point,0),textfont,"Times New Roman",textcolor); ObjectCreate("LINE2",OBJ_LABEL,0,0,0); ObjectSet("LINE2", OBJPROP_XDISTANCE,horizon); ObjectSet("LINE2", OBJPROP_YDISTANCE,veritical+lineapart*1); ObjectSet("LINE2", OBJPROP_CORNER,1); ObjectSetText("LINE2","from day high "+DoubleToStr((dh-Close[0])/Point,0),textfont,"Times New Roman",textcolor); ObjectCreate("LINE3",OBJ_LABEL,0,0,0); ObjectSet("LINE3", OBJPROP_XDISTANCE,horizon); ObjectSet("LINE3", OBJPROP_YDISTANCE,veritical+lineapart*2); ObjectSet("LINE3", OBJPROP_CORNER,1); ObjectSetText("LINE3","from day low "+DoubleToStr((Close[0]-dl)/Point,0),textfont,"Times New Roman",textcolor); ObjectCreate("remind1",OBJ_LABEL,0,0,0); ObjectSet("remind1", OBJPROP_XDISTANCE,0); ObjectSet("remind1", OBJPROP_YDISTANCE,20); ObjectCreate("tpl",OBJ_LABEL,0,0,0); if(allowsound) ObjectSetText("remind1", "Sound is on",12,"Times New Roman",Gray); if(!allowsound) ObjectSetText("remind1", "Mute",12,"Times New Roman",Gray); for (j=0; j<i; j++) {if(StringSubstr(ObjectName(j),0,2)==linename && ObjectType(ObjectName(j))==OBJ_TREND) { yjx=1; price1=NormalizeDouble(ObjectGetValueByShift(ObjectName(j),1), MarketInfo(Symbol(),MODE_DIGITS)); if (TimeCurrent()-PrevAlertTime>timegap*60) { if (Close[1]<=price1 && Close[0]>price1) { if(allowsound) PlaySound("alert.wav"); if(allowalertwindow) Alert(Symbol(),"--- UP"); Print(Symbol(),"--- UP"); PrevAlertTime = TimeCurrent(); ObjectSet("tpl", OBJPROP_XDISTANCE,10); ObjectSet("tpl", OBJPROP_YDISTANCE,20); ObjectSet("tpl", OBJPROP_CORNER,3); ObjectSetText("tpl","THIS CHART BREAKUP",16,"Times New Roman",Red); } if (Close[1]>=price1 && Close[0]<price1) { if(allowsound) PlaySound("alert.wav"); if(allowalertwindow) Alert(Symbol(),"--- DOWN"); Print(Symbol(),"--- DOWN"); PrevAlertTime = TimeCurrent(); ObjectSet("tpl", OBJPROP_XDISTANCE,10); ObjectSet("tpl", OBJPROP_YDISTANCE,20); ObjectSet("tpl", OBJPROP_CORNER,3); ObjectSetText("tpl","THIS CHART BREAKDOWN",16,"Times New Roman",Red); } } if (TimeCurrent()-Prevtext>keeptexttime*60) { if(ObjectFind("tpl")==0) ObjectDelete("tpl"); Prevtext = TimeCurrent(); } } } if (yjx==0) ObjectSetText("remind1", "RENAME AT LEAST ONE LINE NAME TO "+linename+"....",12,"Times New Roman",Red); return(0); }