How to change the defaults line levels (Overbought & Oversold) in the inbuilt RelativeStrengthIndex Indicator
17 Apr 2025, 13:15
Hello there,
I am using a robot with the inbuilt RelativeStrentgIndex indicator which comes with default lines at 30 and 70. I have been unable to figure out how to change these lines (value and colour) in code only. I can do it manually by user interface, but I want to do it by code only. I could go down the custom indicator path but I prefer not to.
I currently use a ChartIndicator just to change the RSI Main Line, but I cannot get to the default 30/70 lines. If I could do it directly in the inbuilt RelativeStrentgIndex indicator then maybe I don't need ChartIndicator, etc….
Snippets of code below. Can some please help and guide me, many thanks.
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None, AddIndicators = true)]
public class BBCOAST2COAST_VER_DRAFT : Robot
{
......
private RelativeStrengthIndex _rsi;
ChartIndicator _indicator1;
......
_rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, RSI_Period);
// Below just allows changes to the main line
_indicator1 = Chart.Indicators.Add("Relative Strength Index", Bars.ClosePrices, RSI_Period);
_indicator1.Lines[0].Color = Color.Yellow;
_indicator1.Lines[0].LineStyle = LineStyle.Solid;
_indicator1.Lines[0].Thickness = 1;
firemyst
18 Apr 2025, 03:30
You can't do it by code unless you code the indicator yourself.
It's stupid how they implemented it. It's via the Levels Attribute.
@firemyst