# Help with RSI(2)

#### donjoe

##### New Member
Can somebody with more AFL skills than me help me with this?

1. It's a RSI(2) strategy I would like to backtest, more or less like Larry Connors strategy. I would buy the stock if RSI(2) falls below the threshold 25. So far I know the AFL code.

2. But I want to buy another unit of that stock if the price closes lower the next day, and if the price falls further the third day I will buy another unit of that stock.
How do I write this AFL?

This is the code I have for part 1. I don't know how to write part 2.

r = RSI(2);
Upper = Optimize("Upper", 70, 60, 99, 1);
Lower = Optimize("Lower", 25, 2, 25, 1);
Condi1 = Cross(Lower,r);

Sell = Cross(r, Upper);

Regards
donjoe

#### manojborle

##### Learner
Can somebody with more AFL skills than me help me with this?

1. It's a RSI(2) strategy I would like to backtest, more or less like Larry Connors strategy. I would buy the stock if RSI(2) falls below the threshold 25. So far I know the AFL code.

2. But I want to buy another unit of that stock if the price closes lower the next day, and if the price falls further the third day I will buy another unit of that stock.
How do I write this AFL?

This is the code I have for part 1. I don't know how to write part 2.

r = RSI(2);
Upper = Optimize("Upper", 70, 60, 99, 1);
Lower = Optimize("Lower", 25, 2, 25, 1);
Condi1 = Cross(Lower,r);

Sell = Cross(r, Upper);

Regards
donjoe
Use Ref() function for 2nd and 3rd day.