Hi,
I'm trying to use a bitmap arrow in my indicator but the background of my arrow hide the prices candle and the back color :
Is there any way to make white as transparent ?
Thank you for your help,
Ghen.
You need to use an image editor to make the background transparent.
You need to use an image editor to make the background transparent.
Thank you for your help Nicholishen. Unfortunately that doesn't work. I remove background with eraser tool of Corel paint shop pro but it's alaways white on MT4.
Maybe I have to save the file in a specific format and with specific options ? for now I save it into standard BMP file...
Any solutions ?
Thanks,
Ghen
Thank you for your help Nicholishen. Unfortunately that doesn't work. I remove background with eraser tool of Corel paint shop pro but it's alaways white on MT4.
Maybe I have to save the file in a specific format and with specific options ? for now I save it into standard BMP file...
Any solutions ?
Thanks,
Ghen
You can follow this guide -- or the easier way would be creating separate bmp images with background colors to match the chart background.
#include <ChartObjects\ChartObjectsBmpControls.mqh> void OnStart() { CChartObjectBitmap label; label.Create(0,"bmp",0,Time[100],Low[100]); label.Background(true); while(!IsStopped()) { color bck = (color)ChartGetInteger(0,CHART_COLOR_BACKGROUND); if(bck == clrWhite) label.BmpFile("arrow_white.bmp"); else label.BmpFile("arrow_black.bmp"); ChartRedraw(); Sleep(500); } }
Hi,
I'm trying to use a bitmap arrow in my indicator but the background of my arrow hide the prices candle and the back color :
Is there any way to make white as transparent ?
Thank you for your help,
Ghen.
You can replace your white background with a transparent one "on the fly".
//--- resources #resource "\\Images\\your_picture.bmp" as bitmap MyPicture[] ... ulong pattern=(ulong(clrWhite)<<8)+255; ... int size=ArraySize(MyPicture); for(int i=0;i<size;i++) { if(MyPicture[i]==pattern) { MyPicture[i]=0; } } ...
You can replace your white background with a transparent one "on the fly".
That's cool... didn't know that. Thanks for sharing!
You can replace your white background with a transparent one "on the fly".
Hi,
It seems to be interesting but MQL4 doesn't want to compile this syntax (only available for MQL5) :
#resource "\\Images\\your_picture.bmp" as bitmap MyPicture[]
Maybe could you provide the good code for MQL4 ?
If I understand the aim is to have a variable of Bitmap type.... but is it possible on MT4 ?
Thanks !
Ghen.
Hi,
It seems to be interesting but MQL4 doesn't want to compile this syntax (only available for MQL5) :
Maybe could you provide the good code for MQL4 ?
If I understand the aim is to have a variable of Bitmap type.... but is it possible on MT4 ?
Thanks !
Ghen.
Use the link provided by Nicholishen.
Use the link provided by Nicholishen.
Hi,
I see the link and read carefully. But Canvas class seems to be usable for MQL5 only.
I'm right ?
Regards,
Ghen.
Hi,
I see the link and read carefully. But Canvas class seems to be usable for MQL5 only.
I'm right ?
Regards,
Ghen.
No, you are not right. Canvas is working well with mql4 too.
I know this subject is very old, but I may have some simpler tip for that, which would help me a lot if it was here, when I first found this thread.
Save your transparent arrow as transparent PNG, then use the free XnView tool to convert it to 32-bit BMP (that is RGB + alpha channel).
I have found transparent BMP exported in Corel and some other software not usable with MQL, while XNView 32-bit BMP exports always work.
Also the image has to be included as a resource for some reason. Transparency stops working if you change the path to load it from the disk instead. Example where transparency works:
#resource "\\Images\\trader2.bmp" [...] string path_to_bar_graphics = "::Images\\trader2.bmp"; BitmapLabelCreate([...]);
And here it won't:
string path_to_bar_graphics = "\\Images\\trader2.bmp"; BitmapLabelCreate([...]);
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm trying to use a bitmap arrow in my indicator but the background of my arrow hide the prices candle and the back color :
Is there any way to make white as transparent ?
Thank you for your help,
Ghen.