How to change the defaults line levels (Overbought & Oversold) in the inbuilt RelativeStrengthIndex Indicator

Created at 17 Apr 2025, 13:15
CT

ctid8068054

Joined 20.10.2024

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;
		

 

 


@ctid8068054
Replies

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

ctid8068054
18 Apr 2025, 10:09

RE: How to change the defaults line levels (Overbought & Oversold) in the inbuilt RelativeStrengthIndex Indicator

firemyst said: 

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.

Thanks firemyst, I try the custom indicator path.  


@ctid8068054