if (!ObjectFind(0, rectangleName))
https://www.mql5.com/en/docs/objects/objectfind
If the object is not found, the function returns a negative number.
void OnStart() { Print(!-1); }

Oh, thank you very very much, I would not have figured that out. After trying it out, it now draws rectangles, although appearing a bit weird. I will continue from here and try and fix what I can.
Do you know of a better logic alternative to get the rectangles to be drawn other than what I used below:
if (ObjectFind(0, rectangleName) < 0)
ITM7 #:
Do you know of a better logic alternative to get the rectangles to be drawn other than what I used below:
if (ObjectFind(0, rectangleName) < 0)
Now the check of the return value of ObjectFind looks correct.
although appearing a bit weird
Sorry, but I don't have time to study your code in detail right now. I showed you your most obvious mistake, which immediately caught my eye.
Now the check of the return value of ObjectFind looks correct.
Sorry, but I don't have time to study your code in detail right now. I showed you your most obvious mistake, which immediately caught my eye.
No problem, thank you once again for taking time out of your busy schedule to assist.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This indicator keeps track of the time remaining before the 4hr candle opens. The time can be specified by the user in intervals of 15 minutes such that the total time does not exceed 4 hours (i.e. 240 minutes). The indicator is supposed to draw a rectangle once the countdown to the remaining time before the 4hr candle opens. The rectangle will start from when the countdown begins, and will end when the countdown ends. The countdown ends when the same amount of time specified has elapsed after the 4hr candle has closed. The indicator does not keep an active count down timer but only checks if the time remaining for the 4hr candle to open is equal to (or less than) the specified time.
The indicator works well by notifying when there’s X amount of time before a 4hr candle closes, but the problem is, the indicator does not draw any rectangle, and there are no errors to why it is not drawing rectangles. I went through the logic several times but still cannot figure out why the rectangles are not being drawn. Can you please help me figure out the error or give me some pointers, your help will be greatly appreciated.
The indicator code is below: