Search code examples
objectlabelrectanglesmql4

MQL4 drawing rectangle over price


I am trying to write a label in a rectangle over the price in the top left corner of my chart with my custom indicator. I can draw the rectangle and the label fine but I cannot get the order in which they display correct. The candlestick chart is always at the top and I can switch around the label and the rectangle's orders by using the following code

ObjectSetInteger(NULL, "objBackground", OBJPROP_BACK,true);

Please help, how do I put the candlesticks at the back, then the rectangle and the label(s) at the the forefront?

Thanks for your help!


Solution

  • Just make chart not on the foreground and you will see objects on top

    bool ChartForegroundSet(const bool value,const long chart_ID=0)
      {
       //--- reset the error value
       ResetLastError();
       //--- set property value
       if(!ChartSetInteger(chart_ID,CHART_FOREGROUND,0,value))
        {
         //--- display the error message in Experts journal
         Print(__FUNCTION__+", Error Code = ",GetLastError());
         return(false);
        }
       //--- successful execution
       return(true);
      }