Are you sure the error code is 4202?
4202 |
ERR_OBJECT_DOES_NOT_EXIST |
Object does not exist |
That doesn't make sense, you would would expect that error when modifying object properties.
Are you sure the error code is 4202?
4202 | ERR_OBJECT_DOES_NOT_EXIST | Object does not exist |
That doesn't make sense, you would would expect that error when modifying object properties.
I tried your code and got the same result as you.
It seems that the problem stems from ChartID()
This code
void OnTick() { //long current_chart_id=ChartID(); string name="tester"; if(ObjectFind(0,name)<0) { if(!ObjectCreate(0,name,OBJ_TEXT,0,0,0)) { Print("Error: can't create object name:",name," code #",GetLastError()); } } ObjectSetDouble(0,name,OBJPROP_PRICE,Low[0]-100*Point); ObjectSetInteger(0,name,OBJPROP_TIME,Time[0]); ObjectSetInteger(0,name,OBJPROP_COLOR,clrWhite); //--- set text property ObjectSetString(0,name,OBJPROP_FONT,"Wingdings"); ObjectSetString(0,name,OBJPROP_TEXT,CharToStr(140)); //--- }
using 0 for the current chart works perfectly
I tried your code and got the same result as you.
It seems that the problem stems from ChartID()
This code
using 0 for the current chart works perfectly
Yes with the STretagy Tester, it must always be 0.
You have true!
Support graphical objects in only Visual Mode!
if (IsVisualMode() ) current_chart_id=0;
if (IsVisualMode() ) current_chart_id=0; .... <others code>
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In old version MT4 (Build 600-) was possible create objects in Tester - visual mode.
But for new build 600+ my code not function, wrote "Error: can't create object name:tester code #4202"
If I use the same code as script and add to chart (no chart tester), object create ok.
When is error?