https://docs.mql4.com/objects/ObjectDelete
Why are you giving it double as argument? It takes a string. The same string that you used in ObjectCreate() that you haven't pasted here.
Hi
Thanks for the reply, is this better? I am new to this mind:
double BB(string up_dn, int barback){int tf = 0; int theBandsPeriod; if(Period() == PERIOD_M1) theBandsPeriod = BandsPeriod2; else theBandsPeriod = BandsPeriod; double hi = iBands(Symbol(),Period(),theBandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_UPPER,barback); double lo = iBands(Symbol(),Period(),theBandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_LOWER,barback); double md = iMA (Symbol(),Period(),theBandsPeriod,0,0,PRICE_CLOSE,barback); if(BandsSetArrow){ SetArrow(4,Teal,hi,"BB hi",Time[barback]); SetArrow(4,Teal,md,"BB midle",Time[barback]); SetArrow(4,Teal,lo,"BB lo",Time[barback]); } if(TimeHour(TimeCurrent())==8){ bool ObjectDelete("BB hi"); bool ObjectDelete("BB middle"); bool ObjectDelete("BB lo"); } if(up_dn == "up"){ return(hi); } if(up_dn == "dn"){ return(lo); } return(md); }
Yes this should work.
However after some searching I found that SetArrow() is a part of MQL3. You could change the SetArrow(4,Teal,hi,"BB hi",Time[barback]); (and the other 2 that are the same) part with:
if(ObjectFind("BB hi") > 0){ ObjectSet("BB hi", OBJPROP_TIME1, Time[barback] ); ObjectSet("BB hi", OBJPROP_PRICE1, hi); }else{ ObjectCreate("BB hi", OBJ_ARROW, 0, Time[barback] , hi); ObjectSet("BB hi", OBJPROP_ARROWCODE, 3); // jsut define whatever arrow type you want from here }
Hope this helped.

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
Hi
I have an EA that draws the objects on the chart, but after a while I find this slows down metatrader, I ma trying to add some code to delete the graphics at specified times, here is my current code:
Now here is what I have tried but with little success:
Thanks
Antony