string value1=DoubleToStr(checkaverage(), 7);
ObjectSetText(objname4, "Average of previous bars:"+value1, 15, "Arial", CornflowerBlue);
ObjectSet("ObjName", OBJPROP_CORNER, 0);
ObjectSet(objname4, x2, 50);
ObjectSet(objname4, y2, 50);
ObjectCreate(objname1, OBJ_LABEL, 0, 0, 0);
string value2=DoubleToStr(checkcurrentfraction(), 7);
ObjectSetText(objname1, "current fraction:"+value2, 15, "Arial", CornflowerBlue);
ObjectSet(objname1, x3, 50);
ObjectSet(objname1, y3, 50);
Now I have two objects on my chart. But the second prints exactly on the previous one.
x2=50
y2=60
x3=50
y3=80
=========
these are the coordinates where the two objects must be written.
string value1=DoubleToStr(checkaverage(), 7);
ObjectSetText(objname4, "Average of previous bars:"+value1, 15, "Arial", CornflowerBlue);
ObjectSet("ObjName", OBJPROP_CORNER, 0);
ObjectSet(objname4, x2, 50);
ObjectSet(objname4, y2, 50);
ObjectCreate(objname1, OBJ_LABEL, 0, 0, 0);
string value2=DoubleToStr(checkcurrentfraction(), 7);
ObjectSetText(objname1, "current fraction:"+value2, 15, "Arial", CornflowerBlue);
ObjectSet(objname1, x3, 50);
ObjectSet(objname1, y3, 50);
Now I have two objects on my chart. But the second prints exactly on the previous one.
x2=50
y2=60
x3=50
y3=80
=========
these are the coordinates where the two objects must be written.
Please read the documentacion about ObjectSet:
string object_name, // object name
int index, // property index
double value // value
);
In the second parameter of ObjectSet() function, you have to use:
OBJPROP_XDISTANCE |
102 |
int |
Integer value to set/get anchor X distance object property in pixels (see note) |
OBJPROP_YDISTANCE |
103 |
int |
Integer value is to set/get anchor Y distance object property in pixels (see note) |
And in the third parameter you specify the desired value.
Regards.
- docs.mql4.com
Please read the documentacion about ObjectSet:
And in the third parameter you specify the desired value.
Regards.
string value1=DoubleToStr(checkaverage(), 7);
ObjectSetText(objname4, "Average of previous bars:"+value1, 15, "Arial", CornflowerBlue);
ObjectSet("ObjName", OBJPROP_CORNER, 0);
ObjectSet(objname4, x2, 50);
ObjectSet(objname4, y2, 50);
ObjectCreate(objname1, OBJ_LABEL, 0, 0, 0);
string value2=DoubleToStr(checkcurrentfraction(), 7);
ObjectSetText(objname1, "current fraction:"+value2, 15, "Arial", CornflowerBlue);
ObjectSet(objname1, x3, 50);
ObjectSet(objname1, y3, 50);
I do not know what are the numbers 50 after x2,y2 and x3,y3.
by changing the x2,y2,x3,y3. there is no change .
I have already two text which are printed at the same position
Wow, you answered mql4 question now !
Yes, it's Christmas, hahaha. :-)).
Regards.
string value1=DoubleToStr(checkaverage(), 7);
ObjectSetText(objname4, "Average of previous bars:"+value1, 15, "Arial", CornflowerBlue);
ObjectSet("ObjName", OBJPROP_CORNER, 0);
ObjectSet(objname4, x2, 50);
ObjectSet(objname4, y2, 50);
ObjectCreate(objname1, OBJ_LABEL, 0, 0, 0);
string value2=DoubleToStr(checkcurrentfraction(), 7);
ObjectSetText(objname1, "current fraction:"+value2, 15, "Arial", CornflowerBlue);
ObjectSet(objname1, x3, 50);
ObjectSet(objname1, y3, 50);
I do not know what are the numbers 50 after x2,y2 and x3,y3.
by changing the x2,y2,x3,y3. there is no change .
I have already two text which are printed at the same position
ObjectSet(objname1, OBJPROP_YDISTANCE, y3);
Thank you . it worked.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to get the output result of a function and show it on the chart:
string value1=DoubleToStr(checkaverage(), 7);
ObjectSetText(pastaverage, "Average of previous bars:"+value1, 15, "Arial", CornflowerBlue);
ObjectSet("ObjName", OBJPROP_CORNER, 0);
ObjectSet(pastaverage, x2, 50);
ObjectSet(pastaverage, y2, 50);
the code above returns no error and also no text on the chart.
pastaverage is the name for my object. and it is defined as a string.
checkaverage() is a function that returns a double output.
x2 and y2 are integers that are defined above.