Mohammad Ali: I wrote a code below to delete all object match with object name
Some time it compile ok some it give error and want to not compile
But as my knowledge code doesn't have any problem.
From the error, I assume you are compiling under MQL4 because there are two variants on using the OrdersTotal() function, so you will have to qualify it and use one of the two alternatives:
... ObjectsTotal( (long) 0 ) // Make it a long and not an int ... ObjectsTotal( 0, -1, -1 ) // Or add the extra parameters ... ObjectsTotal() // Or just use the other variant ...
ObjectsTotal
( https://www.mql5.com/en/docs/objects/objectstotal )
The function returns the number of objects of the specified type in the specified chart. There are two variants of the function:
int ObjectsTotal( long chart_id, // chart identifier int sub_window=-1, // window index int type=-1 // object type );
The function returns the number of objects of the specified type:
int ObjectsTotal( int type=EMPTY // object type );

ObjectsTotal - Object Functions - MQL4 Reference
- docs.mql4.com
When this function is used on the current chart, this chart is accessed directly, while in order to receive the properties of an object on a different chart, a synchronous call is used. The synchronous...
You can also have a look at https://www.mql5.com/en/docs/objects/objectdeleteall

Documentation on MQL5: Object Functions / ObjectsDeleteAll
- www.mql5.com
[in] Prefix in object names. All objects whose names start with this set of characters will be removed from chart. You can specify prefix as 'name' or 'name*' – both variants will work the same. If an empty string is specified as the prefix, objects with all possible names will be removed. The function uses a synchronous call...

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
Dear
I wrote a code below to delete all object match with object name
Some time it compile ok some it give error and want to not compile
But as my knowledge code doesn't have any problem.