of course
qjol:
something like this not checked or tested
something like this not checked or tested
Thank you. I will give that a try.
azFIN:
... Is there a way to cycle through all objects on the chart and only delete the ones that start with a specific string (NY,Tokyo,London)? Thanks.
And you can do LIKE type of operation with
if (StringFind(sSymbol, "EURUSD", 0) > -1)
-BB-
StringFind > -1 means the string is somewhere in the object name. StringFind == 0 means the string STARTS with the name, which is what OP asked
for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--){ string on = ObjectName(iObj); if (StringFind(on, "Tokyo") == 0) ObjectDelete(on); :
When I want the indicator to remove only the objects it created on exit I do it like this:
I declare in itit()
string ID = WindowExpertName();
Then the string name of every object the indicator creates is prefixed with ID for example:
string arrowcount=DoubleToStr(cnt,0); string sellarrow=StringConcatenate(ID," Sell ",arrowcount); ObjectCreate(sellarrow,OBJ_ARROW,0,Time[0],Bid);
So then to remove all the objects in deinit() search for all objects whose name begins with the ID and delete them.
int deinit() {int i,ot,length; string name; //---- find objects length=StringLen(ID); ot=ObjectsTotal()-1; for(i=ot;i>=0;i--) {name=ObjectName(i); //---- delete objects if(StringSubstr(name,0,length)==ID) {ObjectDelete(name); } } //---- return(0); }
WHRoeder:
StringFind > -1 means the string is somewhere in the object name. StringFind == 0 means the string STARTS with the name, which is what OP asked
Indeed he did - but I was expanding the topic for the forum watchers and anticipating <the next> question :)StringFind > -1 means the string is somewhere in the object name. StringFind == 0 means the string STARTS with the name, which is what OP asked
-BB-
BarrowBoy:
Indeed he did - but I was expanding the topic for the forum watchers and anticipating <the next> question :)
-BB-
Indeed he did - but I was expanding the topic for the forum watchers and anticipating <the next> question :)
-BB-
Thank you for all the responses. I will try this out after lunch here and let you know once I get it. Been busy with first NFL game and work since posting. Thanks again.
Got it to work the way I was hoping. Thanks for everyones input.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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 am trying to modify a sessions indicator so it only shows on lower time frames and does not clutter up my charts on larger timeframes. I had added just a delete all objects function which works but also ends up deleting trendlines or anything else I add to my chart. Is there a way to cycle through all objects on the chart and only delete the ones that start with a specific string (NY,Tokyo,London)? Thanks.