RSI > 70 and RSI <30 with exploration

exploration
Tags: #<Tag:0x00007f2d7a301f98>

#1

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.

Thank you so much in advance for your help!


#2

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


#3

@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;
AddColumn( r, "RSI" );
AddColumn( OverBought, "OverBought", 1.0);
AddColumn( OverSold, "OverSold", 1.0);

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

Produces this type of Exploration
image

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 );

image

Or look at recent posts on this forum,

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


#4

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. :slight_smile:


#5

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!


#6

Dear All, i am also learning AFL exploration, thank you for all sharing here.

May I ask what is the code for indicator william's % R in AFL, i have tried WR and William's % but not successful
thanks


#7

Your really are quite lazy

http://lmgtfy.com/?q=amibroker+williams+%25r


#8

@de.yudi.dy why bother coding yet another oscillator. Did you read an article somewhere that tells you how great it is? And what does this mean ??

I thought it was a standard indicator in AmiBroker (at least it's in my copy though I may have put in my own there and forgotten?),

image

The Williams %R is the inverse of the Fast Stochastic Oscillator without the usual smoothing. IMHO it is important that you understand the formula of any indicator you are using, especially simple ones.
R = (Highest High – Closing Price) / (Highest High – Lowest Low) x (-100)
raw %K = (Current Close - Lowest Low)/(Highest High - Lowest Low) * 100

So the AmiBroker built in indicator with parameter's set to a one period smoothing give you the following plot's.

image

For me there is entertainment value in studying these indicators. Because a group of technical analysts who were selling "educational" courses in the 1950's developed the "stochastic" which had that name attached later (even though there is a word in the English language STOCHASTIC = "randomly determined; having a random probability distribution or pattern that may be analyzed statistically but may not be predicted precisely" that has NOTHING to do with this particular indicator).

George Lane was one of the group of analysts selling this material and he was credited with the invention of the stochastic.

A decade later analyst and big time promoter Larry William's essentially copied it and made a slight arithmetic change, then re-labelled it after himself!! Voila, the "new" William's Percent R. Years later Williams in an effort to deflect any criticism of his unoriginal work would slam George Lane as having stolen credit from the other researchers that he (Lane) had been working with in the 1950's when they developed the stochastic.

End of trivia lesson.