Issue with object draw functions

 
Currently at the moment I am running an indicator that basically plots pivots lines.
now the issue I have is that sometimes after awhile the indicator appears to stop workng
and all the object lines that I have drawn disappear from the screen.

The only solution to get the lines to redraw is to move up to a daily Timeframe and then lines reappear and then I can move back to my orginal timeframe say 15 mins.

I can email you the code
but the basics of it are follows

//---- exit if period is greater than daily charts
if(Period() > 1440)
{
Print("Error - Chart period is greater than 1 day.");
return(-1); // then exit
}

ArrayCopyRates(rates_d1, Symbol(), PERIOD_D1);

yesterday_close = rates_d1[1][4];
yesterday_open = rates_d1[1][1];
today_open = rates_d1[0][1];
yesterday_high = rates_d1[1][3];
yesterday_low = rates_d1[1][2];
day_high = rates_d1[0][3];
day_low = rates_d1[0][2];


//---- Calculate Pivots

D = (day_high - day_low);
Q = (yesterday_high - yesterday_low);
P = (yesterday_high + yesterday_low + yesterday_close) / 3;
R1 = (2*P)-yesterday_low;
S1 = (2*P)-yesterday_high;
R2 = P+(yesterday_high - yesterday_low);
S2 = P-(yesterday_high - yesterday_low);



The rest is followed by object draw functions to place the lines on the chart.

Reason: