If this indicator does not work for you. And MetaEditor of your trading terminal shows such error messages when compiling a file with this indicator (it can be, for example, when compiling it for the 1150th build of MetaTrader5):
To compile and run this indicator:
1. Copy this function and add it to the end of the indicator code:
//+------------------------------------------------------------------+ //| Deleting objects by common prefix in object names || //||(and object type, if necessary):| //| 2014 (last modified: 14.07.2015), Dina Paches | //| https://login.mql5.com/ru/users/dipach | //+------------------------------------------------------------------+ //| string prefix_obj = common prefix in object names | //| long chart_ID = chart identifier | //| int sub_window=-1 = window index| //| int type=-1 = object type (or instead of int - object type by | //| enumeration ENUM_OBJECT)| //| int start_pos=-1 = start position of the common prefix substring in | //| the name of the objects| //+------------------------------------------------------------------+ void ObDeleteN(string prefix_obj,int chart_ID=0,int sub_window=-1, int type=-1,int start_pos=0) { int quantObj=ObjectsTotal(chart_ID,sub_window,type); if(quantObj>0) { int count=0; int prefixLen=StringLen(prefix_obj); string name[]; ArrayResize(name,quantObj,quantObj+1); ArraySetAsSeries(name,true); for(int i=quantObj;i>=0;i--) { string objNameX=ObjectName(chart_ID,i,sub_window,type); string findValue=StringSubstr(objNameX,start_pos,prefixLen); if(StringCompare(findValue,prefix_obj,true)==0) { count=count+1; name[count-1]=objNameX; } } if(count>0) { ArrayResize(name,count,count+1); for(int i=count-1;i>=0; i--) { ObjectDelete(chart_ID,name[i]); } } } else return; } //+------------------------------------------------------------------+
2. Put a double slash "//" right before this line in the OnDeinit() and OnChartEvent() sections of the code:
ObjectsDeleteAll(0,prefixObj,0,-1);
3. Copy and put this line into the code of the indicator (put it under the line above and, since the line above occurs twice in the code, you should put this line in two places):
ObDeleteN(prefixObj,0,0);
4. As a result, the code sections with the function variant not working, for example, in build 1150, will look like this in the code:
//ObjectsDeleteAll(0,prefixObj,0,-1); ObDeleteN(prefixObj,0,0);
5. After that, compile the code. Error messages will disappear and the indicator will be ready to work on charts of build 1150 of MetaTrader5.
P./S.: If you have any questions, write here in the discussion or in a private message.
Ugh... it's like a stone has fallen from my soul. "He who seeks will always find" (c) worked, fortunately, this time.
I found the prototypes of the function variant above after all.
And now I can say thank you very much for the detailed scheme to Kovalyov, the textbook author, Artyom and unknown to me by name 7777877.
P./S.: At one time, while parsing the prototypes of this function for myself, getting into its meaning and conducting experiments, I managed not to save (not on purpose!) its sources from MQL4, on the basis of which it was eventually compiled and used in different forms for my codes in MQL4 and MQL5. I have not published the code of this function (or its other variants) publicly or openly before.
I remember that by very unfortunate coincidences I came across works on the site / search not working (or it was that I searched, as I now realise, incorrectly), when my conscience reminded me to find sources. In particular, remembering that I saw information on the scheme on the forum, I did not remember about the textbook. Accordingly, I put it off for "later".
So, treating with respect for the work of others, I try if possible to immediately copy the information, from where / from whom I took what.
Therefore, I am sincerely glad that without any hints or reminders from the outside, I found the primary sources-prototypes of this function for myself.
Please post the code of the indicator with the changes made, it is a dark forest for me, but I need it very much! I can not get it myself. If it is not difficult, the compiled file for mt5!!!!
The indicator version in Kodobase has been changed to version 1.01, with already made changes, and now it is available for download directly from the page of this indicator.
While thinking about replacing the code, I managed to delete my explanation that:
The ObjectsDeleteAll() function, which was replaced by another one in version 1.01, for deleting objects by their name prefix, works faster, which contributes to faster code performance.
Therefore, after the official transition from the 1150th build (which was released at the time when the ability of the ObjectsDeleteAll() function to delete objects by their names prefix was not yet fixed in the Documentation) to another build, it will be better to change the version of the indicator code to the one with the use of ObjectsDeleteAll():
I updated the code of this indicator. Including, having detected, corrected errors in switching on/off the display of indicator lines on the chart (there was a problem when switching on the display of lines after switching off did not work).
Current version: 1.39
I found out that in the code of this indicator for MT5 (version 1.39), I have not added an additional recalculation of values at prev_calculated=0, similar to what is in the code of such indicator for MT4. That is, when working with version 1.39, there is a possibility of situations when zero values may appear in the indicator table at prev_calculated=0.
Sorry.
Now I have sent a new version(1.42) for publication
Since CodeBase moderators are busy people and the update may not be published soon, I will attach the corrected version here for now.
Thanks a lot to CodeBase moderator.
Code updated this afternoon to version 1.42
P./S.: I deleted the file attached above.
Yesterday the update to version 1.45 was released (I have just logged in now)
The main thing: I replaced the function of removing an indicator from the chart - I corrected the value of one of its input parameters.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use


ID Lite Info MA:
The indicator shows Moving Averages (MA) values, difference between values and difference between MA.
Author: Dina Paches