Expert Adviser development - How to find out the RSI line has "flatted out"

 

Hi guys,

I am developing an EA and one of the exit strategies is when the RSI flats out. For example:

http://d.stockcharts.com/school/data/media/chart_school/technical_indicators_and_overlays/relative_strength_in/rsi-2-rsplot.png

Look at between 3 and 5. The peak becomes flat. In these moments, I want to exit my trade.

I understand that  the challenge here is when do we consider the RSI line as flatted out?  How long must the line be to be considered so. I want to consider it on the open of a new candle. So, basically, on the open of a new candle, if the RSI line of the previous 1..2 bars is flat, close the position.

I am thinking here that, for every new candle, I get the RSI of the previous two. If that value is very much similar, then I know there was not much different in the last two bars. But I am missing here the angle of the RSI lines, which needs to be fairly horizontal (no more than a 5 degrees angle).

Any help would be much appreciated!

Felipe 

 
fcaldas Felipe:

Hi guys,

I am developing an EA and one of the exit strategies is when the RSI flats out. For example:

http://d.stockcharts.com/school/data/media/chart_school/technical_indicators_and_overlays/relative_strength_in/rsi-2-rsplot.png

Look at between 3 and 5. The peak becomes flat. In these moments, I want to exit my trade.

I understand that  the challenge here is when do we consider the RSI line as flatted out?  How long must the line be to be considered so. I want to consider it on the open of a new candle. So, basically, on the open of a new candle, if the RSI line of the previous 1..2 bars is flat, close the position.

I am thinking here that, for every new candle, I get the RSI of the previous two. If that value is very much similar, then I know there was not much different in the last two bars. But I am missing here the angle of the RSI lines, which needs to be fairly horizontal (no more than a 5 degrees angle).

Any help would be much appreciated!

Felipe 

Maybe You can find and learn from this indicator for MT4
Reason: