mql4

Mql4 Color Transparency in Rectangle Object


Is it possible to add in color transparency to an object? Eg. I want to make a rectangle and instead of making it while #ffffff i wanted to make it transparent.

I was wondering if anyone can show me some example code to do this?

Thank you


Solution

  • It's not immediately obvious from the ObjectCreate description. You have to make the object appear in the foreground and disable the filling as per the following code:

    ObjectCreate(0,"Rectangle",OBJ_RECTANGLE,0,Time[10],Open[10],Time[0],Open[0]);
    ObjectSetInteger(0,"Rectangle",OBJPROP_COLOR,clrBlack);
    ObjectSetInteger(0,"Rectangle",OBJPROP_FILL,false);
    ObjectSetInteger(0,"Rectangle",OBJPROP_BACK,false);