RSI With Shaded Min and Max

I'm new to coding and had this idea about an RSI indicator that I wanted to figure out on my own without asking for help on the forum. I wanted to a see a red cloud plot when over bought, and green when over sold. I found a formula that did that but I wanted to remove the middle range 30 - 70 line color from the plot when over sold, and overbought. Many searches later I figured it out and thought I would share it here. I can't remember who's code I copied to get started so if you recognize it say hi so I can thank you.

Is there anything more experienced coders would do differently? Anyone see a problem with my work?

John

//	RSI with shaded max min

SetChartOptions(1,0, chartGrid20 | chartGrid30 | chartGrid50 | chartGrid70 | chartGrid80 );
periods = Param( "Periods", 14, 1, 200, 1 );
r = RSI(periods);

Plot( r, "", colorGreen, styleLine | styleClipMinMax | styleNoLabel, 30, 0 );
Plot( r, "", colorRed, styleLine | styleClipMinMax | styleNoLabel, 100, 70 );
IIf( r > 30 AND r < 70, Plot( r, _DEFAULT_NAME(), colorLightOrange, styleLine  | styleClipMinMax ), Null );

PlotOHLC( r,r,50,r, "", IIf( r > 50, colorRed, colorGreen ), styleCloud | styleClipMinMax  | styleNoLabel, 30, 70 );

//	End
1 Like

Hello @Jcpilot nice work.

Here is the code that you started with
So, the thank you goes to..... this person :heart_eyes:

2 Likes

Thanks PanoS. That page would have been useful and now I know it exists. I'm guessing that page is the work of Thomaz? That page actually made me remember where I saw the code the first time. It was a formula that Geoff Lamb posted. Learning to code later in life is slow going let me tell you.

1 Like