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 ?
where should use it ?
4200 means object already exists.
Before creating it;
I just told you where to use 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.
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");
- www.mql5.com
-
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 }
- Why are you testing for false, and then doing nothing with the result?
-
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)
-
PERIOD_CURRENT is zero, so why a constant to the names? Perhaps as_string(PERIOD_CURRENT)
- Why are you testing for false, and then doing nothing with the result?
- 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 .
But its still not show data into chart .
ArraySetAsSeries(true) accurate positive values . when i set it false its gives wrong values .
-
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 - OK, i is a as-series index; use true.
-
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.
- 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 - OK, i is a as-series index; use true.
-
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 .
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Thank you in advanced.