the text disappears

Back to topics list To post a new topic, please log in or register
franky 2015.11.18 09:46

I add a text to indicator :

   if(   fc_tawa(Period(), pos)==1 && (no_gap(Period(),pos-1)) ){  //&& (pinbar(Period(),"bas",ELIOT,VG,REMPL,QTE,TIMING,FILTER,ORDER,BANDS,COEF,pos)==1)
   pin_bas[pos] = iLow(Symbol(),Period(),pos-1)-100*Point*dig(Symbol());
   nom_txt = "slope tmg"+pos;
   ObjectDelete(nom_txt); ObjectCreate(nom_txt, OBJ_TEXT, 0, Time[pos], iLow(Symbol(),Period(),pos)-150*Point*dig(Symbol())); ObjectSetText(nom_txt,"slope+timing bearish", 6, "Arial", Lime);}
   if(  fc_tawa(Period(), pos)==0 && (no_gap(Period(),pos-1))  ){//&& (pinbar(Period(),"haut",ELIOT,VG,REMPL,QTE,TIMING,FILTER,ORDER,BANDS,COEF,pos)==1)
   pin_haut[pos]= iHigh(Symbol(),Period(),pos-1)+100*Point*dig(Symbol());
   nom_txt = "slope tmg"+pos;
   ObjectDelete(nom_txt); ObjectCreate(nom_txt, OBJ_TEXT, 0, Time[pos], iHigh(Symbol(),Period(),pos)+150*Point*dig(Symbol())); ObjectSetText(nom_txt,"slope+timing bullish", 6, "Arial", Salmon);}


All thing is ok, i can see the text in the chart:




 But when i add a second indicator with the same arrow and different text (and different name of text object), the text of the first indicator disappears there remains only the arrows.

   if(  bollin(Period(),"bas",pos)==0 && (no_gap(Period(),pos-1)) ) { //&& (pinbar(Period(),"bas",ELIOT,VG,REMPL,QTE,TIMING,FILTER,ORDER,BANDS,COEF,pos)==1)
   pin_bas[pos] = iOpen(Symbol(),Period(),pos-1)-100*Point*dig(Symbol());
   nom_txt = "bollin"+pos;
   ObjectDelete(nom_txt); ObjectCreate(nom_txt, OBJ_TEXT, 0, Time[pos], iLow(Symbol(),Period(),pos)-150*Point*dig(Symbol())); ObjectSetText(nom_txt,"bollinger bearish", 6, "Arial", Lime);}
   if(  bollin(Period(),"haut",pos)==1  && (no_gap(Period(),pos-1))  ){//&& (pinbar(Period(),"haut",ELIOT,VG,REMPL,QTE,TIMING,FILTER,ORDER,BANDS,COEF,pos)==1)
   pin_haut[pos]= iOpen(Symbol(),Period(),pos-1)+100*Point*dig(Symbol());
   nom_txt = "bollin"+pos;
   ObjectDelete(nom_txt); ObjectCreate(nom_txt, OBJ_TEXT, 0, Time[pos], iHigh(Symbol(),Period(),pos)+150*Point*dig(Symbol())); ObjectSetText(nom_txt,"bollinger bullish", 6, "Arial", Salmon);}


 it is a problem with the platform? are there any other method to add text to an indicator ?


franky 2015.11.18 18:00 #

I try to find solution and i merged the source code of indicators (4 indicators) in one big code source and one indicator with 8 buffers and now i can see all the texts




I can with variables activate/desactivate indicators in the code source according to the symbol.. but i would like to keep them in separated code source and separated mq4 files.


any idea ? 

franky 2015.11.20 10:28 #


while I'm trying to find a solution I noticed that :

the text is random display (in the separated indicators and the big indicator) and when the text disappers all the object in the object list are deleted (other text, trend line, triangle of harmonic pattern...)

it is easily verified by adding text (with the same method as in the preceding code) to an indicator.


i want to report this bug (how can i do that ?)


is there a temporary solution for this problem ? 

Keelan 2015.11.20 15:43 #

If you've spliced various indicators do you have #property indicator_separate_window and #property indicator_chart_window both initiated?


As for the Objects im guessing theres some logical error, somewhere, such as your writing data to the wrong buffer for that object at which point all buffers go out of sync or such. Have you custom built the object classes? 


What is this function return? dig(Symbol())  Digits?  


as far as im aware theres no garbage collection but you might want to check, also if theres an overflow somewhere everything would probably disappear.  Theres too many unknown functions there to say why it doesnt work, as the code is identical other than the calls to different functions.



franky 2015.11.21 11:32 #

Thank you for answer,

1) only #property indicator_chart_window

 2) the code is simple, i don't detecd error and it's a random problem. if it's a error in the code i think that the problem will be permanent
what kind if error can delete all object ?


3) dig it's like digits 5 decimals (and 3 for jpy) .. if digits is 4 or 2 décimal the function return 5 or 3 (when i put 100 it's always 10 pips in 4 or 5 decimals)

WHRoeder 2015.11.21 13:59 #
franky: . if digits is 4 or 2 décimal the function return 5 or 3 (when i put 100 it's always 10 pips in 4 or 5 decimals)
That makes no sense. You need to convert pips to decimals and to points (for slippage). pips2dbl or
#define  CHANGE         double      ///< Difference of two prices.
#define  POINT          int         ///< `CHANGE / _Point`.
#define  PIP            double      ///< `POINT / PipsPerPOINT`.
CHANGE   points_to_change(POINT n){          return n * _Point;                }
POINT    change_to_points(CHANGE c){         return POINT(c / _Point + 0.5);   }
CHANGE   pips_to_change(PIP n){     return points_to_change(pips_to_points(n));}
PIP      change_to_pips(CHANGE c){  return points_to_pips(change_to_points(c));}
POINT    pips_to_points(PIP n){              if( (_Digits&1) == 1)   n *= 10.0;
                                             return POINT(n);                  }
PIP      points_to_pips(POINT n){PIP p = n;  if( (_Digits&1) == 1)   p /= 10.0;
                                             return p;                         }
// Digits            DE30  EURNOK   USDJPY   EURUSD   USDMXN   USDZAR
// Digits            1     5        3        5        4        5
// point             0.1   0.00001  0.001    0.00001  0.00001  0.00001
// ticksize          0.5   "        "        "        "        "
// Pip/lot(USD)            1.19     8.23     10.00    0.60     0.73
// Spread                  214.8    1.9      2.3      351.4    181.7
// Spread/lot(USD)         256.31   15.64    23.00    211.97   133.33

franky 2015.11.21 14:13 #

Thank you,

I have not expressed myself well

this is the function 

double dig(string paire){
 if( (MarketInfo(paire,MODE_DIGITS)==4) || (MarketInfo(paire,MODE_DIGITS)==2)  ) return(0.1);
 if( (MarketInfo(paire,MODE_DIGITS)==3) || (MarketInfo(paire,MODE_DIGITS)==5)  ) return(1.0);return(1.0);}


if i put 150*point : if it's 4 digits, it's means 150 pips. But if it's 5 digits it means 15 pips. I use this function for not to change the value "150" to "15" according to number of digits. But this not important have you any idea for the problem of deleting all objects ? Thank you

WHRoeder 2015.11.21 14:58 #
You got it backwards. If digit is 4 then 150 pips -> 150 points. if digits is 5 then 150 pips -> 1500 points.
franky 2015.11.23 00:34 #

I finally found the solution, it can help somebody one day:


If an indicator A call an indicator B (A is attached on the chart)

 if the indicator B is in a separate window

  if the indicator B is not attached on the chart

   if the indicator B contains "ObjectCreate" ---> All objects in the object list will be deleted randomly (the window of B must be found before creating any object by "objectcreate" .... if(WindowFind != -1) ObjectCreate...)


there is the error message in terminal but I have not noticed among the hundreds of lines.

Back to topics list  

To add comments, please log in or register