Drawings change color of candles

 
How can I draw an object that wouldn't overlap and change the color of candles with its own color? Now my indicator looks like on the first screenshot but I want it to look like on the second. Please help
Files:
 
One option is to move the chart to the foreground so that all graphical objects will be behind the candles. This option is available in the Chart Properties (F8).
 
It worked, thanks a lot. But is it possible to somehow code it in the indicator so that when you add it to the chart, this setting is automatically turned on? Because indicator on the second screenshot seems to be drawn behind the candles by default
 
Andrii Hurin #: It worked, thanks a lot. But is it possible to somehow code it in the indicator so that when you add it to the chart, this setting is automatically turned on? Because indicator on the second screenshot seems to be drawn behind the candles by default

Yes, you can change the "Foreground" option from MQL.

ChartSetInteger

Sets the integer value (datetime, int, color, bool or char) for a corresponding property of the specified chart

ENUM_CHART_PROPERTY_INTEGER

CHART_FOREGROUND

Price chart in the foreground

bool

 
Great, thank you!