Search code examples
unicodeindicatormt4

mt4 indicator count day


I need to use "Count Day" code for indicator. It does work fine, but this indicator keeps previous day object till I restart MT4.

What is wrong below code?

if(day >= drowDays) {
break;}

Also you can see chart screenshot link.


Solution

  • You're not providing sufficient information to your problem :'( With the limited info, what I can say is that you need to delete the graphical objects created for previous day.

    Assuming your indicator will plot the latest line, then you MIGHT (again, this is a guess as there is not enough information of your code) be able to achieve it with the ObjectsDeleteAll() function at the start of your OnCalculate(). Obviously, this is not efficient, but is something you can think about.