Object overlapping color problem - page 3

 
This is a legit problem.

 

It took me a bit to track down the answer to this, but its now working very easily so I'm updating a couple of these threads.

The library you need is iCanvas by @Nikolay7ko.

https://www.mql5.com/en/forum/296241/page2#comment_51358580


Example use to fix the infamous rectangle issue:

Canvas.Erase(W.Color);
datetime startTime, endTime;
double PriceTop, PriceBottom;
uint rectColor = 0xFF72fc72;  // Color must be uint 4 channel hex with alpha
// insert logic code here....
Canvas.FillRectangle((int)(Canvas.X(startTime)),(int)(Canvas.Y(PriceBottom)),(int)(Canvas.X(endTime)),(int)(Canvas.Y(PriceTop)),rectColor);
Canvas.Update();


Libraries: Easy Canvas (iCanvas)
Libraries: Easy Canvas (iCanvas)
  • 2022.09.07
  • www.mql5.com
Articles, Library comments: Libraries: Easy Canvas (iCanvas)
 
Rob Perrett #:

It took me a bit to track down the answer to this, but its now working very easily so I'm updating a couple of these threads.

The library you need is iCanvas by @Nikolay7ko.

https://www.mql5.com/en/forum/296241/page2#comment_51358580


Example use to fix the infamous rectangle issue:



Hello Rob!


I was able to create some rectangles in my zones, but as I move the chart, the rectangles stay static... is there a way to move the rectangles as we move the chart?

Regards,

 
Leonardo Al Santiago Montilla #:

Hello Rob!


I was able to create some rectangles in my zones, but as I move the chart, the rectangles stay static... is there a way to move the rectangles as we move the chart?

Regards,

are you updating the display as the chart moves ? 

 
Lorentzos Roussos #:

are you updating the display as the chart moves ? 

How do I do that?

I cant find in on any example.

Thanks!

 
Leonardo Al Santiago Montilla #:

How do I do that?

I cant find in on any example.

Thanks!

void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
  {
  if(id==CHARTEVENT_CHART_CHANGE){
    //call the drawing function here
    }
  }
 
Lorentzos Roussos #:

Still have not managed, I want a "rectangle" to be attached to a "time,price" when I move the chart. Is there any example?
Also how can I draw several rectangles, when I add a new one, basically the "old one" gets updated to the new coordinates.

Thanks!