I am coding an indicator. How dow I write a text string at a specified position in the chart window(window 0)?????

 
Hi folks,

As you can see I have created an Object "Close". I have used ObjectSetText() to output the ema price to the Main Chart Window (Win 0). This works except that I actually have 3 ema's, w/objects, and the 3 text strings/price over lap each other. I would really like to have the text/ema price to be printed on the main chart price bar/y-axis.

dCloseBuff[nCnt]= iMA(NULL,0,EMAPeriod,0,MODE_EMA,PRICE_CLOSE,nCnt);
bRetVal = ObjectCreate("Close", OBJ_TEXT, 0, Time[0], dCloseBuff[0]);
ObjectSetText("Close", DoubleToStr(dCloseBuff[0], Digits), 10, "Times New Roman", White);

I have tried to use:
// ObjectSet("Close", OBJPROP_YDISTANCE, 50);
//OBJPROP_YDISTANCE
//OBJPROP_XDISTANCE

but this has no effect.

Any help would be greatly appreciated,
TC
 
You can't have 3 text objects with same name.
Try use GetLastError if bRetVal is false;
Reason: