myObjName2 = StringConcatenate(myObjString2,myObjInt2);
ObjectCreate(myObjName2, OBJ_TEXT, 0, Time[barIndex1], barLow1-(WindowPriceMax()-WindowPriceMin())/30);
ObjectCreate(myObjName2, OBJ_TEXT, 0, Time[barIndex1], barLow1-(WindowPriceMax()-WindowPriceMin())/30);
The same object name is used on lines 148 and 189. You should give them different names.
The same applies to "myObjName3".
And also you need to confirm the object exists or not with "ObjectFind".

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
Hi I'm new to C++ MT4 style. Can someone please help me to understand how to prevent my custom indicator objects being duplicated when I open the MT4 application? The duplicated objects dissappear once I click into another timeframe (H1) and click back to the orginal timeframe (M30). I have tried setting the buffers to EMPTY_VALUE at the start of the for loop and tried the ObjectsDeleteAll at various sections throughout the code, but to no avail.
I have attached images OnStartUp showing the duplicated values and then what the chart looks like PostStartUp after clicking out and back into the original timeframe.
Please also see a snipit of my code below.