I am trying to create a text object that displays the current day of the candle. I have the candle day sorted, but the ObjectCreate() function is not working for me.
Code: Select all
void CreateDayLabel() {
PrintString("CreateDayLabel() called");
char* label = "DayLabel";
if( ObjectCreate(label, obj_Text, 0, Time(0), High(0)) ) {
PrintString("Day label create success, setting object text");
ObjectSetText(label,"UNSET DAY",16,"Impact",clRed);
}
else { PrintString("obj_Text create failed"); }
// example from help file (not working either)
PrintString("creating testObj");
ObjectCreate("testObj", obj_Text, 0, Time(10), Close(0));
ObjectSetText("testObj", "Test text", 12, "Arial", clYellow);
ObjectSet("testObj", OBJPROP_VALIGNMENT, tlBottom);
ObjectSet("testObj", OBJPROP_HALIGNMENT, taLeftJustify);
}
My first ObjectCreate attempt is always returning false, printing the fail statement.
I also copied the example from the help files, which doesn't seem to be working either.
I also tried the obj_TextLabel in the enum, didn't work.
Can anyone see what I am doing wrong?