Change line color once it reaches above/below a value
Change line color once it reaches above/below a value
18 Dec 2020, 06:57
Hi guys, how do I change the color of the Aroon line once it reaches above 50 and below -50? I want to create an indicator like the picture shown below.
Please note that I'm not a coder and have no experience in programming language but here's the code I've done so far. Any advice will be much appreciated, thanks!
namespace cAlgo.Indicators
{
[Levels(100, -100)]
[Indicator(AccessRights = AccessRights.None)]
public class AroonCombined : Indicator
{
private Aroon _aroon;
[Parameter(DefaultValue = 25)]
public int Period { get; set; }
[Output("Combined", PlotType = PlotType.Line)]
public IndicatorDataSeries Combined { get; set; }
protected override void Initialize()
{
_aroon = Indicators.Aroon(Period);
}
public override void Calculate(int index)
{
double val = (_aroon.Up[index] + -_aroon.Down[index]);
Combined[index] = val;
}
}
}
Replies
pancakeman
18 Dec 2020, 08:55
RE:
PanagiotisCharalampous said:
Hi pancakeman,
To achieve this you need to use different IndicatorDataSeries outputs for each color and use the DiscontinuousLine plot type. You can find an example here.
Best Regards,
Panagiotis
Hi Panagiotis,
Thank you so much! That solved my problem!
Have a great day sir!
With Appreciation,
pancakeman
@pancakeman
PanagiotisCharalampous
18 Dec 2020, 08:04
Hi pancakeman,
To achieve this you need to use different IndicatorDataSeries outputs for each color and use the DiscontinuousLine plot type. You can find an example here.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous