# RSI > 70 and RSI <30 with exploration

Hi All,

I’m really newbie to AFL, and I’d like to ask your help.

I’d like to scan RSI > 70 as overbought
and RSI < 30 as oversold.

then put them in separate columns when I run exploration.

1 Like

Hello and welcome to the forum

Yes I know…. if you new user and you don’t have done any exploration in the past maybe is difficult to think how to start.
And I can see that with the way you ask a help.
By saying << put them in separate columns when I run exploration.>>
Before I start to write a readymade afl for you that is maybe 5-6 lines all together. I really like you @bluesand22 to read little bit that links
And then just start to write few lines and come back and tell us where you stuck.
I think it is nice to go step by step and to be more confidence by writing your thinking to afl
I will start here to write the first 2 lines. Then you have to write the other 3-4 lines for exploration
So . you said RSI()>70 , RSI < 30

You can write with so simple logic… what rsi( period ) you like ? lets say 14 bars

``````// your first 2 condition lines are here
Overbought = rsi(14)>70;
Oversold = rsi(14)<30;
``````

For most of amibroker users we can write the afl for you but the point is we like to teach you how to… that’s why I am not giving you this code you are asking. Because we like you to join here and to be strong as you can.
I hope you like to learn?
IF NOT let me know and I will write the code for you just once.

There are youtube videos and tutorial if you write to google amibroker exploration
https://www.amibroker.com/guide/h_exploration.html
http://www.amibroker.com/kb/tag/exploration/

and again wellcome to AB forum

4 Likes

@bluesand22 I was typing this as @PanoS post appeared almost simultaneously.

So another simple example here,

``````r = RSI( 3 );

OverBought = r > 70;
OverSold = r < 30;

// Explore //
Filter = 1;

// Chart //
Plot( r, "RSI", colorWhite );
``````

Produces this type of Exploration

That does the job but you can of course create almost any output you want,

``````period = Param( "RSI period", 3, 2, 30, 1 );

SetChartOptions( 0, 0, ChartGrid30 | ChartGrid70 );
r = RSI( period );

OverBought = r > 70;
OverSold = r < 30;

// Explore //
OBcolor = IIf( OverBought, colorRed, colorDefault );
OScolor = IIf( OverSold, colorGreen, colorDefault );
Filter = 1;
AddColumn( r, "RSI( " + period + ") " );
AddColumn( OverBought, "OverBought", 1.0, colorDefault, OBcolor );
AddColumn( OverSold, "OverSold", 1.0, colorDefault, OScolor );

// Chart //
Plot( RSI( period ), "RSI( " + period + ") ", colorWhite );
PlotOHLC( r, r, 50, r, "", IIf( r > 50, colorRed, colorGreen ), styleCloud | styleClipMinMax, 30, 70 );
``````

Or look at recent posts on this forum,

And really read this entire thread and the information contained within it.

8 Likes

Hello @PanoS, thank you for this… you’re right, I’m here to learn… for now, I’m familiarizing myself with Ami’s syntaxes while trying to build testing programs… Thank you @PanoS, thank you for guiding me.

1 Like

hello @portfoliobuilder, this is amazing! thank you soo soo much! Now I have ideas on how to put 'em together… my previous program was just for overbought, and i don’t know how to put oversold into another column… thank you so much for your generous help!! you’re awesome!

4 posts were split to a new topic: Williams %R indicator

Hi ,

That was a very nice explanation of the code.Could you please help me get the same RSi for monthly.
I am planning to write a similar one but for the monthly TF.