Maybe the object is already created before you run this new indicator, but anyway using the StringReplace function here does not make sense. You should use ObjectSetString function:
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam) { string obj_name = "Object"; if(id==CHARTEVENT_OBJECT_CREATE && sparam==obj_name) { ResetLastError(); if(!ObjectSetString(0, obj_name, OBJPROP_TEXT, "new text")) PrintFormat("Unable to change: %s text. Error: %d", obj_name, GetLastError()); else PrintFormat("%s text changed successfully", obj_name); } }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
One of my indicators is printing text not good on the chart, I do not have the mq4 file for that indicator.
Can I move and replace text using another indicator?
I tried Object list, but not keep Also, this code did not work
I would appreciate any ideas?