Have you seen that picture?

 

Hi,

I created an indicator to display volume + spread as 90° turned text objects in its separate window.

At the beginning everything looks perfect!, but after a while (some hours on the m1 chart) it gets mad look at the attached snapshot.

Can it be that mt4 gets into troubles by the non standard font that I use: Monofonto?

My error-function ErrN(_LastError) doesn't show any error!

This is the function that creates the objects (I doubled Line, as I thought it might be caused by the length):

#define ErrN(n) if(n>1){ Print(__FILE__," L:",__LINE__," Error# ",(string)_LastError ); ResetLastError(); } // usage ErrN(GetLastError());

string showVoSpr(long vol, int spr, int b=0 ){
        bool a,c,d;
        ResetLastError();
        if ( actBar != Time[b] ) {
                maxSpr=spr; minSpr= spr; //reset max & min
                VolEma = (Volume[b+1] -VolEma)*VOL_EmaConst + VolEma; // calc Vol.Ema
                actBar = Time[b]; // set newBar
                chScale = (int)ChartGetInteger(0,CHART_SCALE); //check scale for font-size
                objID  = IndiName+(string)TimeDay(actBar)+"."+TimeToStr(actBar,TIME_MINUTES); //Obj.ID: "SpVo 7.18:35"
                if ( ObjectFind(objID) >= 0 ) ObjectDelete(objID);
                ResetLastError(); // is set if not found :(
                a = ObjectCreate(0,objID,OBJ_TEXT,IndiWin,actBar,0);
                ErrN(_LastError); 
                d = ObjectSet(objID,OBJPROP_ANGLE,90); 
                ErrN(_LastError);// ERR_OBJECT_DOES_NOT_EXIST
        } else if ( ObjectFind(objID) < 0 ) {
                ResetLastError(); // is set if not found :(
                a = ObjectCreate(0,objID,OBJ_TEXT,IndiWin,actBar,0);
                ErrN(_LastError);//ERR_OBJECT_ALREADY_EXISTS
                d = ObjectSet(objID,OBJPROP_ANGLE,90);
                ErrN(_LastError);
        }
        maxSpr = fmax(maxSpr,spr); minSpr = fmin(minSpr,spr);
        Line = StringConcatenate(
                                        (string)spr," (",(string)minSpr,"-",(string)maxSpr,")  ",
                                        (string)vol," {",DoubleToStr(VolEma,0),"}"
               );
   switch (chScale) {
        case 3:
              c = ObjectSetText(objID,Line+"  "+Line,7,"Monofonto",White); 
              break;
        case 4: //
              c = ObjectSetText(objID,Line+"  "+Line,9,"Monofonto",White); 
              break;
        case 5: // biggest candles
              c = ObjectSetText(objID,Line+"  "+Line,11,"Monofonto",White); 
              break;
           default:
                ObjectSet(objID,OBJPROP_BACK,true);
              c = ObjectSetText(objID,Line+"  "+Line,11,"Monofonto",clrNONE); 
              break;
   }
   ErrN(_LastError);
   return(Line);
}


After some hours the indicator looks like:


PS: I tried to post it at the service-desk but when I click on the save button I get the error message: Enter your request title (it may not exceed 100 characters)

while in that field I entered: "Text-Objects getting mad?" :(

Have a nice weekend.

 
I believe the text is being created over and over. Maybe delete object and recreate it?
 
deysmacro:
I believe the text is being created over and over. Maybe delete object and recreate it?

no -

1) I checked it and I posted the code and you can see either that a new object is created only if it couldn't be found otherwise only the text is changed.

2) I was running

c = ObjectSetText(objID,Line+"  "+Line,11,"Monofonto",White);

in this way for a longer time the values are written without this 'art of writing':

c = ObjectSetText(objID,Line+"  "+Line,11,"",White);
 
Is objID  assigned a different value elsewhere in your code?
 
GumRai:
Is objID  assigned a different value elsewhere in your code?

No! Only the values to be displayed are calculated out of this function.

BTW I attached this indi. at the chart (first entry) at 16:18. The first "mutiple-stamp" appears at 20:01 until the market closes with 10 'after-burners' ;)

May be it's a buffer overflow to get admin. rights ;)

 
In this case, using canvas will be more preferable in terms of performance, code size, and features.
The matter is that objects live the independent life in an asynchronous stream which you cannot supervise.  This is especially true for a large number of objects.
 
Nikolai Semko #:
In this case, using canvas will be more preferable in terms of performance, code size, and features.
The matter is that objects live the independent life in an asynchronous stream which you cannot supervise.  This is especially true for a large number of objects.
thanks for the info , unfortunately because i am new to mql4 I dont understand how that translate to actual mql code 
 
Carl Schreiber:

Hi,

I created an indicator to display volume + spread as 90° turned text objects in its separate window.

At the beginning everything looks perfect!, but after a while (some hours on the m1 chart) it gets mad look at the attached snapshot.

Can it be that mt4 gets into troubles by the non standard font that I use: Monofonto?

My error-function ErrN(_LastError) doesn't show any error!

This is the function that creates the objects (I doubled Line, as I thought it might be caused by the length):


After some hours the indicator looks like:


PS: I tried to post it at the service-desk but when I click on the save button I get the error message: Enter your request title (it may not exceed 100 characters)

while in that field I entered: "Text-Objects getting mad?" :(

Have a nice weekend.

Hello did you solve this problem? I was looking for an indicator similar to the one you were working on , can you share the code ? even if it is not finished maybe i can take it from where you leave it