Problem with change of timeframe

 
I've created an indicator that put automatically orizontal lines on the mt4 platform in oder to indentify targets. But, if later i draw a separated trendline and then I change timeframe,the trendline and everythings else I have on the platforms (like comments) goes away... Is there someone that knows how to solve this problem? 
 
You have code that deletes them in deinit/OnDeinit. Change your indicators/EA to only delete what they put on the chart.
 
William Roeder:
You have code that deletes them in deinit/OnDeinit. Change your indicators/EA to only delete what they put on the chart.

Thank you for your reply but

The onDenit function eliminate specified objects that I've created with codes.

void OnDeinit(const int reason)

  {

//---

  ObjectDelete(0,"Res1");

  ObjectDelete(0,"Res2");

  }  

 

Why it eliminates also objects that are not related to the code? like the trendline that i draw later?

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 
GreenKobra: Why it eliminates also objects that are not related to the code? like the trendline that i draw later?

That code doesn't.

Reason: