The indicator uses SharpDx to draw rectangles, one rectangle per bar.
The rectangle x coordinate and width need to be very accurate so that the rectangle will reside "inside the bar" and fit the width of the bar.
This technique worked perfect except the fact that I can not assign zorder to SharpDX draw object in order to draw the rectangle behind the bar.
To overcome this I decided to draw the rectangle using the draw tool.
Based on my previous and working calculation of the rectangle location and size
DateTime StartTime = ChartControl.GetTimeByX((int)(xstart ));
DateTime EndTime = ChartControl.GetTimeByX((int)(xend ));
As in order to draw the rectangle the X coordinated is expressed in Time .
Draw.Rectangle(this, Tag, StartTime, LowClusterPrice, EndTime, HighClusterPrice, Brushes.Blue);
The result of this was not good as the X location of the rectangle were not accurate as before. Probably as the result of working with time and not as I draw with SharpDx
what can be done to solve it ?
The interface to build draw object include BarAgo or Time , why it does include X coordinate ? ( while converting from X to time and back to X we probably loss accuracy )
Comment