how to set semi-transparent color to buffer?

 

is there a way to set semi-transparent color indicator's line?


i used this but none of these  work:

......

SetIndexStyle(1, DRAW_HISTOGRAM , STYLE_SOLID, 1,  StringToColor("0, 0,127,0")  );

SetIndexStyle(1, DRAW_HISTOGRAM , STYLE_SOLID, 1,  0x00FF1234  );

SetIndexStyle(1, DRAW_HISTOGRAM , STYLE_SOLID, 1,  ColorToARGB(clrRed, 0x55)  );

SetIndexStyle(1, DRAW_HISTOGRAM , STYLE_SOLID, 1,  ColorToARGB(clrRed, 0.55)  );

 
  1. MT4 has only RGB not ARGB.
    Color Type - Integer Types - Data Types - Language Basics - MQL4 Reference
    The first byte is ignored, the remaining 3 bytes contain the RGB-components.
    So of course they don't work. Can't be done.
  2. StringToColor Only takes one argument of RGB. Invalid call.
    String representation of a color of "R,G,B" type or name of one of predefined Web-colors.
  3. ColorToARGB Came from MT5 but alpha is ignored per #1.
 
SO, in mt4 we cant have semi-transparent lines/histograms, right?
 
selnomeria:
SO, in mt4 we cant have semi-transparent lines/histograms, right?
Yes you can but not using indicator's buffer.
 


//============================================================================
//    ModColor
//============================================================================
color ModColor(double clr)
{
   double k = 0.9;
   uchar alfa=0x80;
   string strClr = ColorToString(clr);
   string strRed,strGreen, strBlue;
   string strRed2,strGreen2, strBlue2;
   int pos;
   int cRed, cGreen, cBlue;
   color val;
   //Print( " strClr = ",  strClr );
   
   //return(ColorToARGB(clr,alfa));
   
   if(Осветление_Заливки < 0 || Осветление_Заливки>1)
      k = 0.9; 
   else
      k = Осветление_Заливки;
   
   pos = StringFind(strClr, ",", 0);
   strRed = StringSubstr(strClr, 0, pos);
   strClr = StringSubstr(strClr, pos+1);
   pos = StringFind(strClr, ",", 0);
   strGreen = StringSubstr(strClr, 0, pos);
   strClr = StringSubstr(strClr, pos+1);
   strBlue = strClr;
   cRed      = StrToInteger(strRed);
   cGreen    = StrToInteger(strGreen);
   cBlue     = StrToInteger(strBlue);  
   
   cRed = cRed + (255-cRed)*k;
   cGreen = cGreen + (255-cGreen)*k;
   cBlue = cBlue + (255-cBlue)*k;
   
   strRed2     = IntegerToString(cRed);
   strGreen2   = IntegerToString(cGreen);
   strBlue2    = IntegerToString(cBlue);
   
   val = StringToColor(strRed2 + "," + strGreen2 + "," + strBlue2);
   return(val);
   //Print( " strRed = ",  strRed, " strGreen = ",  strGreen, " strBlue = ",  strBlue );

     
Files:
SUNmFAN_0.6.mq4  39 kb
 
poruchik:



No, they will get the value of TRANSPARENT COLOR, but the value itself, is not obtained by BUFFER as transparent.

 
poruchik:


Can you write what your script does please?
 
poruchik:


Thank you for contribution.

Reason: