ChartScreenShot does not pick up OBJ_TEXT

 
I have a requirement where I want to print some text to the chart. The text should  remain under a specific bar (i.e., a fixed time and price) as new bars are printed the text should move left with the price `OBJ_TEXT` does this but when I run ChartScreenShot the text is not captured.

I then tried with OBJ_LABEL but this does not hold it's position at a specific price and time it's  using pixel coordinates relative to a specified corner of the chart. So it hold the position relative to a corner as bars are printed. This is not what I want, but it is captured by  ChartScreenShot which is what I want. 

Here are the functions I am using:

bool CreateOrUpdateText(string labelName, string text, datetime time, double price) {
    if (ObjectFind(0, labelName) != -1) {
        // Object exists, update it
        ObjectSetString(0, labelName, OBJPROP_TEXT, text);
        ObjectMove(0, labelName, 0, time, price);
    } else {
        // Object does not exist, create it
        if (!ObjectCreate(0, labelName, OBJ_TEXT, 0, time, price)) {
            Print("Failed to create text object: ", labelName, " Error: ", GetLastError());
            return false;
        }
        ObjectSetString(0, labelName, OBJPROP_TEXT, text);
        ObjectSetInteger(0, labelName, OBJPROP_COLOR, clrWhite); // Set text color
        ObjectSetInteger(0, labelName, OBJPROP_SELECTABLE, false);
        ObjectSetInteger(0, labelName, OBJPROP_FONTSIZE, 8); // Set font size
    }
    ChartRedraw(); // Ensure the chart is updated
    return true;
}


bool ConvertXYToTimePrice(int x, int y, datetime &time, double &price) {
    int subWindow;
    if (ChartXYToTimePrice(0, x, y, subWindow, time, price)) {
        return true;
    } else {
        DPrint("Error converting X:"+x+ " Y"+y+" to Time & Price: " + IntegerToString(GetLastError()), ERROR);
        return false;
    }
}


    void CreateOrUpdateRelativeLabel(string labelName, string labelText, int xPos, int yPos) {
        if (ObjectFind(0, labelName) == -1) {
            ObjectCreate(0, labelName, OBJ_LABEL, 0, 0, 0);
            ObjectSetInteger(0, labelName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
            ObjectSetInteger(0, labelName, OBJPROP_XDISTANCE, xPos);
            ObjectSetInteger(0, labelName, OBJPROP_YDISTANCE, yPos);
            ObjectSetInteger(0, labelName, OBJPROP_COLOR, clrWhite);
            ObjectSetInteger(0, labelName, OBJPROP_FONTSIZE, 8);
            ObjectSetInteger(0, labelName, OBJPROP_SELECTABLE, false);
            ObjectSetInteger(0, labelName, OBJPROP_HIDDEN, true);
        }
        ObjectSetString(0, labelName, OBJPROP_TEXT, labelText);
        ObjectSetInteger(0, labelName, OBJPROP_XDISTANCE, xPos);
        ObjectSetInteger(0, labelName, OBJPROP_YDISTANCE, yPos);
    }



ChartScreenShot(0, fileName, 4410, 1918, ALIGN_RIGHT);

  • Is the only work around here to create a function that uses ` ChartTimePriceToXY` to continually convert the Price and Time of the anchor bar X and Y coordinates and then update my labels? 
  • Is there a way to have  OBJ_TEXT be included in the screenshot?
  • Any other workarounds?