deinit()

 
In build 200 downloaded now, the deinit() function is not called from a custom indicator when changing the chart time frame.
 
I cannot reproduce your problem. My custom indicators deinitialized properly.

Can you expose source of your deinit() function?
 
Everything is working fine now, maybe too much testing!

I have included the source of my little test program, it is nearly there but some glitches still occur such as label writing over the label for a previous bar/candle. If you have time to look it over, I would appreciate it. Thanks Slawa.

//+------------------------------------------------------------------+
//|                                    TestVerticalTextPlacement.mq4 |
//|                                                sx ted 2006.11.18 |
//+------------------------------------------------------------------+

#property indicator_chart_window
extern color ColorText=White;
//extern int MaxObjectsToDisplay=50;
extern int FontSize=8;

#define SCALED_M1    20
#define SCALED_M5    38
#define SCALED_M15  100
#define SCALED_M30  157
#define SCALED_H1   168
#define SCALED_H4   286
#define SCALED_D1   556
#define SCALED_W1  1247
#define SCALED_MN1 3258

datetime prevTime=D'01.01.2006';
int iMaxObjects, iObjNum, x, i, iScaleAdjust, iCharAdjust;

int init() {
  string sChar, sChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789()abcdefghijklmnopqrstuvwxyzzz"; // 64 chars
  DeleteObjects();
  iMaxObjects=MathMin(StringLen(sChars)+4, Bars);
  iObjNum=-1;
  // determine factors for adjustment of vertical text
  switch(Period()) {
    // approximate adjustment factor based on font size 8 on char "W" replicated 26 times
    case PERIOD_M1 : iScaleAdjust=SCALED_M1 ; iCharAdjust=2; break;
    case PERIOD_M5 : iScaleAdjust=SCALED_M5 ; iCharAdjust=2; break;
    case PERIOD_M15: iScaleAdjust=SCALED_M15; iCharAdjust=2; break;
    case PERIOD_M30: iScaleAdjust=SCALED_M30; iCharAdjust=2; break;
    case PERIOD_H1 : iScaleAdjust=SCALED_H1 ; iCharAdjust=2; break;
    case PERIOD_H4 : iScaleAdjust=SCALED_H4 ; iCharAdjust=4; break;
    case PERIOD_D1 : iScaleAdjust=SCALED_D1 ; iCharAdjust=5; break;
    case PERIOD_W1 : iScaleAdjust=SCALED_W1 ; iCharAdjust=0; break;
    case PERIOD_MN1: iScaleAdjust=SCALED_MN1; iCharAdjust=3; break;
  }
  
  for(i=5, x=0; i<iMaxObjects; i++, x++) {
    sChar=StringSubstr(sChars, x, 1);
    DisplayVerticalText(i, StringPadL(sChar, sChar, 26));
  }
  DisplayVerticalText(4, StringChangeToUpperCase("AbCdEfGhiJkLmNoPqRStUVWXyZ"));
  DisplayVerticalText(3, StringChangeToLowerCase("AbCdEfGhiJkLmNoPqRStUVWXyZ"));
  DisplayVerticalText(2, StringChangeFirstToUpperCase("abCdE ghiJk mNoPq St85WXyZ"));
  return(0);
}

int deinit() {
  DeleteObjects();
  return(0);
}

int start() {
  if(prevTime == Time[0]) return(0); // only start routine on complete bars
  DisplayVerticalText(1, StringChangeFirstToUpperCase("abCdE ghiJk mNoPq St85WXyZ"));
  prevTime=Time[0];
  // debug
  Print("Time[1]=",TimeToStr(Time[1],TIME_DATE|TIME_MINUTES)," WindowPriceMax()=",WindowPriceMax()," WindowPriceMin()=",WindowPriceMin());
  // end debug
  return(0);
}

void DeleteObjects() {
  //for(int i=0; i <= MaxObjectsToDisplay; i++) {
  for(int i=0; i <= iMaxObjects; i++) {
    if(ObjectFind("o"+i) >= 0) ObjectDelete("o"+i);
  }
  Comment("");
}

#define _a         2153
#define _b         2139
#define _c         1781
#define _d         2126
#define _e         2139
#define _f         1063
#define _g         2140
#define _h         2140
#define _i          732
#define _j          731
#define _k         1808
#define _l          732
#define _m         2871
#define _n         2139
#define _o         2139
#define _p         2139
#define _q         2153
#define _r         1063
#define _s         1809
#define _t         1091
#define _u         2154
#define _v         1808
#define _w         2527
#define _x         1794
#define _y         1809
#define _z         1808
#define _A         2554
#define _B         2498
#define _C         2498
#define _D         2499
#define _E         2499
#define _F         2139
#define _G         2871
#define _H         2499
#define _I         1062
#define _J         1795
#define _K         2512
#define _L         2153
#define _M         2858
#define _N         2499
#define _O         2871
#define _P         2498
#define _Q         2857
#define _R         2499
#define _S         2499
#define _T         2153
#define _U         2512
#define _V         2526
#define _W         3258
#define _X         2513
#define _Y         2527
#define _Z         2168
#define __         1095  // ASCII char 32 " "
#define _LB        1091  // ASCII char 40 "("
#define _RB        1090  // ASCII char 41 ")"
#define _0         2154
#define _1         2154
#define _2         2154
#define _3         2154
#define _4         2154
#define _5         2154
#define _6         2154
#define _7         2154
#define _8         2154
#define _9         2154
 
void DisplayVerticalText(int x, string str) {
  // determine suitable placement of vertical text and avoid overwriting of bars/candles if possible,
  // and calculate x and y co-ordinates of middle of the string to feed to MT4 ObjectCreate(),
  // only "Arial" font can be used for vertical text in MT4 at present.
  double y;
  int    iCnt=StringLen(str), i, iLen, iPos;
  // widths based on each character replicated 26 times and scaled off chart PERIOD_MN1 using font size 8:
  int    w[]={_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,_p,_q,_r,_s,_t,_u,_v,_w,_x,_y,_z,
              _A,_B,_C,_D,_E,_F,_G,_H,_I,_J,_K,_L,_M,_N,_O,_P,_Q,_R,_S,_T,_U,_V,_W,_X,_Y,_Z,
              __,_LB,_RB,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9};
  // calculate width of text
  for(i=0; i < iCnt; i++) {
    iPos=StringFind("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ()0123456789",
         StringSubstr(str, i, 1), 0);
    iLen+=w[iPos];
  }
  if(WindowPriceMax()-High[x] > Low[x]-WindowPriceMin())
    // prorata to current chart period, plus visual adjustment for overlaid characters with bar/candle
    y=High[x]+NormalizeDouble(iLen*iScaleAdjust/SCALED_MN1/(26-iCharAdjust*2)/2*Point, Digits);
  else
    y=Low[x]-NormalizeDouble(iLen*iScaleAdjust/SCALED_MN1/(26-iCharAdjust*2)/2*Point, Digits);
  // respect the quantity of the external MaxObjectsToDisplay parameter
  if(iObjNum >= iMaxObjects) iObjNum=-1;
  iObjNum++;
  if(ObjectFind("o"+iObjNum) >= 0)
    ObjectDelete("o"+iObjNum);
  // display the text vertically  
  ObjectCreate("o"+iObjNum, OBJ_TEXT, 0, Time[x], y);
  ObjectSet("o"+iObjNum, OBJPROP_COLOR, ColorText);
  ObjectSetText("o"+iObjNum, str, FontSize);          
  ObjectSet("o"+iObjNum, OBJPROP_ANGLE, 90);
}

string StringChangeToUpperCase(string sText) {
  // Example: StringChangeToUpperCase("oNe mAn"); // ONE MAN 
  int iLen=StringLen(sText), i, iChar;
  for(i=0; i < iLen; i++) {
    iChar=StringGetChar(sText, i);
    if(iChar >= 97 && iChar <= 122) sText=StringSetChar(sText, i, iChar-32);
  }
  return(sText);
}

string StringChangeToLowerCase(string sText) {
  // Example: StringChangeToLowerCase("oNe mAn"); // one man
  int iLen=StringLen(sText), i, iChar;
  for(i=0; i < iLen; i++) {
    iChar=StringGetChar(sText, i);
    if(iChar >= 65 && iChar <= 90) sText=StringSetChar(sText, i, iChar+32);
  }
  return(sText);  
}

string StringChangeFirstToUpperCase(string sText) {
  // Example: StringChangeFirstToUpperCase("oNe mAn"); // One Man
  int iLen=StringLen(sText), i, iChar, iLast=32;
  for(i=0; i < iLen; i++) {
    iChar=StringGetChar(sText, i);
    if(iLast==32 && iChar >= 97 && iChar <= 122) sText=StringSetChar(sText, i, iChar-32);
    else if(iLast!=32 && iChar >= 65 && iChar <= 90) sText=StringSetChar(sText, i, iChar+32);
    iLast=iChar;
  }
  return(sText);  
}

//+------------------------------------------------------------------+
//| Function..: StringPadL                                           |
//| Parameters: str   - string to be padded left with sChar,         |
//|             sChar - character to be pre-pended to str,           |
//|             iLen  - length of output string to be returned.      |
//| Examples..: string s="01"+StringPadL("Jan", " ", 4); // "01 Jan" |
//| Purpose...: Pad string <str> to the left with character(s)       |
//|             <sChar> to output a string of length <iLen>.         |
//+------------------------------------------------------------------+
string StringPadL(string str, string sChar, int iLen) {
  while( StringLen(str) < iLen ) str=sChar+str;
  return(str);
}
//+------------------------------------------------------------------+
Reason: