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.
namespacecAlgo.Robots
{
[Robot(AccessRights = AccessRights.None, AddIndicators = true)]
publicclassBBCOAST2COAST_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;
This website uses cookies to enhance site navigation, analyze site usage, and assist in our marketing efforts. By clicking “Accept All” you are providing your consent to our use of all cookies. Alternatively, please provide your choice by pressing “Customize Cookies”. For more information, please read our Privacy policy
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