For example
ENUM_OBJECT OBJECT_TYPE ( const string OBJECT_NAME ) { return (ENUM_OBJECT) ObjectGetInteger ( ChartID () , OBJECT_NAME , OBJPROP_TYPE ) ; }
Everything seems to be alright
But
I have never before thought about doing anything with objects that have already been deleted
<like in code sample at the start of topic>
The 'sparam' value is definitely recording the correct horizontal line name but doesn't return the correct Object_Type value.
If I change it to this as per your suggestion
if(id == CHARTEVENT_OBJECT_DELETE) { Print("sparam = ",sparam," object = ",ObjectGetInteger ( ChartID () , sparam , OBJPROP_TYPE ) ," chartId = ",ChartID()," error = ",ErrorDescription(GetLastError())); if(ObjectType(sparam) == OBJ_HLINE) {
the output is
It returns the value of a vertical line which is strange. The ChartID is also correct.
The code doesn't even make it to the lopp because of the error.
As I say it was working at one stage and I didn't change the code so not sure what's going on.
I guess I need to store the object to determine which type has been removed?Clarity 100%
Idea of storing the object <properties of object> to determine which type has been removed looks nice
And also it is interesting what will be printed when just before Print (..); will be inserted ResetLastError();
Clarity 100%
But it is interesting what will be printed when just before Print (..); will be inserted ResetLastError();
I quickly tried that and it resets the error message to 'no error' but the Object_TYpe is still -1 value.
I've changed the way I do it now by moving to the next chart and checking for the existence of the same name line then deleting it. Seems to work.
Thanks for your comments.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
I have an indicator that duplicates horizontal lines across multiple charts on different timeframes. The code to place and move the lines works fine but the code that deletes the lines does not work.
The print output is:
I did get this working in a test program but now it doesn't work.
Any ideas please?
thanks