Text Object show problem

 

4200 means object already exists.

use 

ObjectDelete(0,obj_name);

Before creating it;

Or use 

ObjectFind(...

To check for its existence before trying to create it.

 
Marco vd Heijden:

4200 means object already exists.

use 

Before creating it;

Or use 

To check for its existence before trying to create it.

Thank you for you comment . Can you please take a look into my code and markup where should use it ? 

 
Komoles Kumar:

 where should use it ? 

Marco vd Heijden:

4200 means object already exists.

Before creating it;

I just told you where to use it.

 
Komoles Kumar: Can you please take a look into my code and markup where should use it ? 
MT4: Learn to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
 
William Roeder:
MT4: Learn to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.


 

After adding check function its says 4202 warnings .


 

Check This out: https://www.mql5.com/en/docs/constants/errorswarnings/errorcodes

If you want to clear everything you can use:

ObjectsDeleteAll(0);

Or if you only want the ones that start with :

ObjectsDeleteAll(0,"Text");
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
  • www.mql5.com
The name of the custom symbol is invalid. The symbol name can only contain Latin letters without punctuation, spaces or special characters (may only contain ".", "_", "&" and "#"). It is not recommended to use characters <, >, :, ", /,\, |, ?, *. The...
 
  1.       if(!TextDelete(0,"Text_"+(string)i+(string)PERIOD_CURRENT)) {}

    PERIOD_CURRENT is zero, so why a constant to the names? Perhaps as_string(PERIOD_CURRENT)

    string      as_string(ENUM_TIMEFRAMES aePeriod){
       if(aePeriod == PERIOD_CURRENT)   aePeriod = ENUM_TIMEFRAMES(_Period);
       string   period_xxx  = EnumToString(aePeriod);                 // PERIOD_XXX
       return StringSubstr(period_xxx, 7);                            // XXX
    }
    
  2. Why are you testing for false, and then doing nothing with the result?

  3.    for(int i=rates_total-1; i>rates_total-bars; i-=step){
          if(close[i]>open[i])
    The passed arrays have no direction. i is a non-series index here, so you must set them as ArraySetAsSeries(false)

 
William Roeder:
  1. PERIOD_CURRENT is zero, so why a constant to the names? Perhaps as_string(PERIOD_CURRENT)

  2. Why are you testing for false, and then doing nothing with the result?

  3. The passed arrays have no direction. i is a non-series index here, so you must set them as ArraySetAsSeries(false)

I cover your all point of instruction . But its still not show data into chart . 

 

ArraySetAsSeries(true)  accurate positive values . when i set it false its gives wrong values . 

What is the next way ? 

Now the problem is Object is crated but not shown into the chart. There is no Geterror() code return . 

 
Komoles Kumar:

 But its still not show data into chart . 

ArraySetAsSeries(true)  accurate positive values . when i set it false its gives wrong values .

  1.    int bars=(int)ChartGetInteger(0,CHART_VISIBLE_BARS)+3;
       ⋮
       gTotalRates=rates_total;
       for(int i=rates_total-1; i>rates_total-bars; i-=step)
    Your loop processes all bars, every tick, except those that are visible. Why? Just do all bars.
              How to do your lookbacks correctly #9 - #14 & #19

  2. OK, i is a as-series index; use true.

  3. TextCreate(0,"Text_"+(string)i,

    You can't use an as-series index in names as they are not unique; as soon as a new bar starts, you will be trying to create a new name (e.g. "name0",) as same the existing, previous name (e.g. "name0" now on bar one.)

    Use time (as int) or a non-series index:

    #define  SERIES(I)   (Bars - 1 - I) // As-series to non-series or back.
 
William Roeder:
  1. Your loop processes all bars, every tick, except those that are visible. Why? Just do all bars.
              How to do your lookbacks correctly #9 - #14 & #19

  2. OK, i is a as-series index; use true.

  3. You can't use an as-series index in names as they are not unique; as soon as a new bar starts, you will be trying to create a new name (e.g. "name0",) as same the existing, previous name (e.g. "name0" now on bar one.)

    Use time (as int) or a non-series index:

Thank you William Roeder Master . Now the code is working well .