I created a new strategy with two conditions. If condition 1 is true than Backbrush.Green and if condition 2 is true than Backbrush.Red. Both conditions at the same time can`t be true. So I tried:
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 161)
return;
if (condition 1)
{
BackBrush = Brushes.Green;
}
if (condition 2)
{
BackBrush = Brushes.Red;
}
}
And it worked fine. Now I want to change the opacity. So I tried:
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 161)
return;
if (condition 1)
{
BackBrush = new SolidColorBrush(Colors.Green) {Opacity = 0.25};
BackBrush.Freeze();
}
if (condition 2)
{
BackBrush = new SolidColorBrush(Colors.Red) {Opacity = 0.25};
BackBrush.Freeze();
}
}
But this don't work. If have only one color. How can I create two different custom brushes and use them?
Comment