Buy or Sell at specific RSI


I’m still learning to code and was wondering whether it is possible to specify the buy price as the price at a specific RSI level.

Buy = Cross(RSI(5),30) AND (High > EMA(Close,5));
BuyPrice = RSI(5)==30.25;
Sell = RSI(5)>=75 OR (Low < EMA(Close,5) AND RSI(5)<45);

Buy --> When High is above 5 period EMA. Also, 5 period RSI crosses or has already crossed 30 from below.
Buyprice --> Amibroker must consider buyprice as the price that would have been when RSI(5) is 30.25

In other words --> I will have a buy stop ready for the price level at which RSI(5) will be 30.25, if price is more than EMA.

Sell --> Sell if RSI(5) equals or is greater than 75; alternative exit --> if low falls below 5 period EMA and 5 period RSI is less than 45.


@PanoS @snoopy.pa30

any pointers or help? many thanks for the assistance

To do this you would need a Reverse RSI Solver to determine the price at which a particular RSI value would occur. You can find such a Solver on Cesar Alvarez’s site:

1 Like

Dear friends,

I need AFL with RSI with popup alerts at 60 BUY & At 40 SELL
Can any friend help me on this.

at present using below formula, would like to add ALERT at 60 BUY & At 40 SELL -

periods = Param( "Periods", 15, 1, 200, 1 );
Plot( RSI( periods), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );


@mandy do not post the same request in multiple threads. Also if you are starting a new topic just start a new forum thread. Search the user guide and the knowledge base and this forum before asking someone to do all your work for you.

An example of finding buy or sell RSI levels that may help you get started,

Your "code" is just the Plot of an RSI. If you are looking to add BUY and SELL arrows then review

For Alerts, and PopUP information try the user guide,

Lastly but most importantly there are great tips for learning in this thread

@portfoliobuilder i am new in this forum and wrongly posted many times, just try to reach maximum people. Secondly don't assume thing that i want "someone to do all my work for me"...i tried your link before you sent in my AFL but since AFL writing is new for me, its not working and thats why i asked for help.

@mandy welcome to AmiBroker, glad that you are trying to learn. I have not seen any code from you that shows where you are having a problem? I have not seen your code for "Buy" and "Sell", nor have you shown the forum that you are a properly licensed user. Once you get that badge and show your codes I am sure someone on the forum will help fix your code efforts.

Good luck and once again welcome to the AmiBroker community.

1 Like