I want to draw, within the visible bars window, rectangular boxes which represent a forex session (Start/End time and session high/low). To achieve this I use RenderTarget.FillRectangle() in a loop through painted bars (FromIndex – ToIndex) in the OnRender method. Example below the indicator is applied to GBPUSD in a 15-minute time frame, 6 March 2019. Works fine until I add opacity (line 248), I get the following visual effect:
Later in the code I add the day of week above the rectangle with the RenderTarget.DrawTextLayout() instruction in OnRender.
When scrolling the chart with the right arrow key older TextLayout result remain on the chart. How to erase previous textlayout? I think the 2 effect are linked, what is wrong with this coding? Creating the SharpDXbrush before the loop and dispose right after should be enough, correct?
[ATTACH]n1051506[/ATTACH]
Comment