Hi, I'm currently having an issue with drawing a rectangle from a bitmap file to prevent color overlap when drawing a rectangle normally. I have successfully drawn this bitmap file, and the width and height are correct. However, the problem lies in the incorrect positioning, despite using X_Distance, Y_Distance, Time1, Price1, Time2, and Price2. If anyone has experience with this situation, I would greatly appreciate your help. Thank you very much.
- Coding help
- How to draw that trendline?
- Create a rectangle with 2 clicks
The Anh Pham:
Hi, I'm currently having an issue with drawing a rectangle from a bitmap file to prevent color overlap when drawing a rectangle normally. I have successfully drawn this bitmap file, and the width and height are correct. However, the problem lies in the incorrect positioning, despite using X_Distance, Y_Distance, Time1, Price1, Time2, and Price2. If anyone has experience with this situation, I would greatly appreciate your help. Thank you very much.
Hi, I'm currently having an issue with drawing a rectangle from a bitmap file to prevent color overlap when drawing a rectangle normally. I have successfully drawn this bitmap file, and the width and height are correct. However, the problem lies in the incorrect positioning, despite using X_Distance, Y_Distance, Time1, Price1, Time2, and Price2. If anyone has experience with this situation, I would greatly appreciate your help. Thank you very much.
Add the code and the result.
// Chuyển đổi tọa độ thời gian và giá thành tọa độ biểu đồ int x1, y1, x2, y2; if (ChartTimePriceToXY(0, 0, time1, price1, x1, y1) && ChartTimePriceToXY(0, 0, time2, price2, x2, y2)) { // Tính toán kích thước của hình chữ nhật int width = MathAbs(x2 - x1); int height = MathAbs(y2 - y1); // Tạo đối tượng bitmap int bmpObj = ObjectCreate(0, name, OBJ_BITMAP, 0, time1, price1, time2, price2); // set the size and other properties ObjectSetInteger(0, name, OBJPROP_XSIZE, width); ObjectSetInteger(0, name, OBJPROP_YSIZE, height); // x offset ObjectSetString(0, name, OBJPROP_BMPFILE, bitmapFile); ObjectSetInteger(0, name, OBJPROP_SELECTABLE, true); // Không cho phép chọn đối tượng ObjectSetInteger(0, name, OBJPROP_SELECTED, true); // Hiển thị đối tượng ObjectSetInteger(0, name, OBJPROP_FILL, true); ObjectSetInteger(0, name, OBJPROP_BACK, true); }
Hi,
Thanks for your response. Now the rectangle is drawn 10 bars away from the correct time.
This is not the same as half the width of the rectangle, so I don't understand why it is positioned like this.
Sorry that I can't give you an image to demonstrate this issue, because I'm using a MacBook and MetaTrader 4 doesn't work on this laptop.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register