How to set BarColor programmatically
How to set BarColor programmatically
21 Apr 2022, 01:18
Hello,
I know SetBarColor() can change a specific index bar's color.
What I want to do, is to set all bar's color in my indicator (the same effect as of right click chart area and choose 'Color Option' then change the color items), according to some conditions, like symbol name or moving speed, so the chart can easily catch my eyesight?
Thanks.
Replies
Capt.Z-Fort.Builder
21 Apr 2022, 15:23
RE:
Thank you very much. It works very well.
BTW, I checked the BearOutlineColor but I didn't get the correct syntax until you put your sample code above.
Thanks again. :)
amusleh said:
Hi,
Try this:
using cAlgo.API; namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)] public class SampleSMA : Indicator { protected override void Initialize() { // Bullish bars Chart.ColorSettings.BullFillColor = Color.Blue; Chart.ColorSettings.BullOutlineColor = Color.Blue; // Bearish bars Chart.ColorSettings.BearFillColor = Color.Gold; Chart.ColorSettings.BearOutlineColor = Color.Gold; } public override void Calculate(int index) { } } }
@Capt.Z-Fort.Builder
amusleh
21 Apr 2022, 10:45
Hi,
Try this:
@amusleh