ObjectCreate( "name",OBJ_TEXT,0,0,arrUSD[0]+5*Point); //Why in the main chart window??
bool ObjectCreate(
string name, int type, int window, datetime time1, double price1, datetime time2=0, double price2=0, datetime time3=0,
double price3=0)
Creation of an
object with the specified name, type and initial coordinates in the specified
window. Count of coordinates related to the object can be from 1 to 3 depending
on the object type. If the function succeeds, the returned value will be TRUE.
Otherwise, it will be FALSE. To get the detailed error information, one has to
call the GetLastError() function.
Objects of the OBJ_LABEL type ignore the coordinates. Use the function of ObjectSet() to set up the OBJPROP_XDISTANCE and OBJPROP_YDISTANCE
properties.
Notes: The chart sub-windows (if there are sub-windows with
indicators in the chart) are numbered starting from 1. The chart main window
always exists and has the 0 index.
Coordinates must be passed in pairs: time
and price. For example, the OBJ_VLINE object needs only time, but price (any
value) must be passed, as well.
but I am unlucky, still it did not work
Same question . . . can you answer please ?
I am a beginner in programming, and know little about this.
I just want to display "USD" near the curve in CCFp. I changed the following code, but it still not work.
do you mean the "ObjectCreate() is not in right place? I really don't know where I should place them.
{ int width = 0; if(0 > StringFind(Symbol(), "USD", 0)) width = 1; else width = Line_Thickness; SetIndexStyle(0, DRAW_LINE, DRAW_LINE, width, Color_USD); SetIndexBuffer(0, arrUSD); SetIndexLabel(0, "USD"); ObjectCreate( "name",OBJ_TEXT,0,0,arrUSD); ObjectSet("name", OBJPROP_XDISTANCE, 100); ObjectSet("name", OBJPROP_YDISTANCE, 100); ObjectSetText("name","USD",10,"Tahoma",Gold); }I learned to code a MA with name and value,it works.
I learned to code a MA with name and value,it works.
See, it wasn't so hard after all . . .
:)
I am still waiting for help, why the following code does not work.
{ int width = 0; if(0 > StringFind(Symbol(), "USD", 0)) width = 1; else width = Line_Thickness; SetIndexStyle(0, DRAW_LINE, DRAW_LINE, width, Color_USD); SetIndexBuffer(0, arrUSD); SetIndexLabel(0, "USD"); ObjectCreate( "name",OBJ_TEXT,0,0,arrUSD); ObjectSet("name", OBJPROP_XDISTANCE, 100); ObjectSet("name", OBJPROP_YDISTANCE, 100); ObjectSetText("name","USD",10,"Tahoma",Gold); }:)
I am still waiting for help, why the following code does not work.
in one code
in your other code
Can't you see the difference? As Raptor has already asked, where will the first object be placed on the chart?
Here you are trying to place a OBJ_TEXT on the chart using co-ordinates for a OBJ_LABEL, it won't work
in one code
in your other code
Can't you see the difference? As Raptor has already asked, where will the first object be placed on the chart?
Here you are trying to place a OBJ_TEXT on the chart using co-ordinates for a OBJ_LABEL, it won't work
Thanks,
I tried to change the code, but it did not work, :-(
Thanks,
it still doesn't work.
{ int width = 0; int i =0; if(0 > StringFind(Symbol(), "USD", 0)) width = 1; else width = Line_Thickness; SetIndexStyle(0, DRAW_LINE, DRAW_LINE, width, Color_USD); SetIndexBuffer(0, arrUSD); SetIndexLabel(0, "USD"); // ObjectCreate( "name",OBJ_TEXT,0,Time[i],arrUSD[i]+5*Point); ObjectCreate( "name",OBJ_TEXT,0,0,arrUSD[0]+5*Point); // ObjectSetText("name",DoubleToStr(arrUSD)," /MA20",10,"Tahoma",Gold); //ObjectSet("name", OBJPROP_XDISTANCE, 100); //ObjectSet("name", OBJPROP_YDISTANCE, 100); ObjectSetText("name","USD",10,"Tahoma",Gold); }