it is probably because you are incrementing the counter while deleting the objects that are being counted therefore after the 3rd object is deleted the counter "i" is at 3 while the amount of objects left is 2 so i is no longer smaller than objects total so the cycle ends before the last 2 are deleted.
try
for (int i=obj_total; i>0; i--)
I agree with SDC
I use the following code
// How do you combine text & code in same post ???
int DeleteAllMyObj(string pPrefix)// How do you combine text & code in same post ???
it is probably because you are incrementing the counter while deleting the objects that are being counted therefore after the 3rd object is deleted the counter "i" is at 3 while the amount of objects left is 2 so i is no longer smaller than objects total so the cycle ends before the last 2 are deleted.
try
Thanks SDC you were spot on! All is working just fine now..
// How do you combine text & code in same post ???


- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Has anyone seen this before. I have just 5 objects drawn on a chart 4 Text objects and 1 vertical line. When I try to use the following:
The last two text objects are not deleted. GetLastError() returns 4202 and the log shows an error for ObjectDelete() complaining that the string is empty.
A further Print(name); confirms empty strings when Object Properties in the terminal shows names and descriptions.
ObjectDeleteAll() works fine however I want to add another condition for ObjectType() but cant get past this issue.
What am I missing..
Any help greatly appreciated.