AFL for RSI Crossing above 45 & below 55

pankajpari

RSITradeMaster
#1
Hi,
I came across one thread in this forum wherein one member had posted his system which he was using in the forex market :
Buy when RSI crosses above 50 and Sell when RSI crosses below 50.


Supposedly a very simple system but when I checked it manually on Bank Nifty Futures chart, it gave quite good results. I changed the same a little bit as follows :
Buy when RSI crosses above 45 and Sell when RSI crosses below 55.


I also checked it with the NICK MA Swing AFL and found that the signals from this RSI system were received a little earlier than that received from NICK MA Swing.

I wanted to back test this system to check if it is really profitable. And hence, would like to request the seniors / experts in AmiBroker to create an ALF for the same.

I intend to use this system for swing trading with 30 minute / 60 minute / Daily Time Frame. Using it with 15 minute Time frame also seems to be giving good results.

In addition to the AFL, I would also request the seniors / experts (i) to provide their feedback on this system and (ii) if there is any way the same can be improved upon by adding any other indicator(s).

Thanks.

Regards,

Pankaj:lol:
 

johnnypareek

Well-Known Member
#2
Hi,

Well, Can you please write in what TF u bactested and what was it whether 14 rsi or 5 or 21 rsi.

okay default is given below with parameter n optimization. :)
_SECTION_BEGIN("Pr
ice"); SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C,
1 )) ));
Plot(C,"",1,128);
b =Optimize("Buy Trigger",Param("Buy Trigger",45,5,65,1),5,65,1);
s=Optimize("Sell Trigger",Param("Sell Trigger",55,1,40,1),1,90,1);
SetPositionSize( 50, spsShares ); // 50 shares by default

Buy=Cross(RSI(),b);
Sell=Cross(s,RSI());

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
shape = Buy * shapeUpArrow +Sell * shapeDownArrow ;

PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );
If u can share what time frame it is good for, Will try to modify.

johnnypareek
 
Last edited:

pankajpari

RSITradeMaster
#3
Thnx Johnny, that was quick.

a) I have tested the same with RSI(8) on TF of Daily, 60 Min & 30 Min. It seemed to work even on lower TF of 15 Min & 5 Min but it gives many whipsaws.
b) Further, I found that it works better on scrips with higher volatility like Nifty & Bank Nifty (much better with Bank Nifty).
c) Also, if the RSI crosses above 45 giving a Buy signal but turns back, it should again trigger a Sell signal once it crosses below 45.
d) Similarly, if the RSI crosses below 55 giving a Sell signal but turns back, it should again trigger a Buy signal once it crosses above 55.
e) Sometimes, it is possible that the RSI(8) crosses above 45 / below 55 at the EOD. In that case, on the next day I check on the 15 Min TF if the RSI(8) has crossed above 45 / below 55 and accordingly go Long / Short.
f) I am using it with Twigg's Money Flow to check if the Indicator is rising when a Buy is triggered and falling when a Sell is triggered.
g) I also check for previous swing high / low breakouts [but the RSI(8) with the buy above 45 & sell below 55 seems to take care of the breakouts as well]
h) I colour the Bars using MACD :
- If MACD Line is below Zero and Signal Line is above MACD Line => Red
- If MACD Line is above Zero and Signal Line is below MACD Line => Green
- Else => Black

My observation might be wrong as I have checked the same manually (with what ever little knowledge I have on Technical Analysis) and would hence request you to back test the same at your end.

Pls let me know if you require any other information.

May be I am asking for too much, but it will be really nice if you can :
(i) check with which parameters it gives better results (optimisation),
(ii) if there is any way the same can be improved upon by adding any other indicator(s), say for instance adding an indicator to Exit Buy or Cover Short instead of using a Stop & Reverse method,
(iii) share your back testing results,
(iv) provide your feedback on this system,
(v) change the code to colour the bars using the below mentioned criteria (to know whether the market is Bullish, Bearish or Range Bound) instead of using MACD :
- Bullish (Green colour bars) => if Aroon Up is above the 70 line and Aroon Down is below 30
- Bearish (Red colour bars) => if Aroon Down is above the 70 line and Aroon Up is below 30
- Range Bound (Black colour bars) => if Aroon Up and Aroon Down are between 70 & 30
(vi) create an Exploration / Scan (only if you feel this system is good and if you have the time)

I am new to Technical Analysis and have recently started exploring AmiBroker (since the last 3 months) and hence, requesting the above.

Thnx.

Regards,
Pankaj
 

johnnypareek

Well-Known Member
#4
Hey,

Wow, U r new and have done this much then u r good learner. Good. Well, this will take some time. Will try on holiday only. Thanks for prompt and detailed post.

johnny
 
#5
Hi,
I wish to have the similar AFL which can be look like this. if any where it available please paste here.

30 min stocastic signal , 60 min rsi signal and 15 min macd, 20ema signals etc., like this in one AFL in the 5 min chart.

I would also request the experts to please give your valuable advice upon reliable afl for trading purpose.
 

pankajpari

RSITradeMaster
#6
Thnx man, I take that as a compliment. Actually, the market teaches you the hard way.....lost money and had almost lost all hopes of entering the market again when this divine thought to learn Technical Analysis struck me like a lightening. Been at it since the last 6 months now. Great to have guys like you on a forum like this to assist & motivate the newbies. Thnx once again.

I have also been experimenting with Displaced MA crossover (8, 21, 34 & 55 EMA with displacement of -3). I have seen that it follows an uptrend / down trend 1 or 2 bars earlier than the normal EMA and also provides early trend reversal signal.

It seems to be a good trend following indicator as it turns a MA from a lagging indicator to a leading one, but haven't seen many using it. Am I missing something in my study (going wrong somewhere of its benefits) or it is actually not a good idea to practically use it as a trend following indicator.

If its possible for you, kindly provide your feedback on this as well in addition to the above.

Looking forward to your revert.

Regards,

Pankaj
 
#9
Hi,

Well, Can you please write in what TF u bactested and what was it whether 14 rsi or 5 or 21 rsi.

okay default is given below with parameter n optimization. :)


If u can share what time frame it is good for, Will try to modify.

johnnypareek
Hello. I have tried this afl & it works fine. But I found that if there is already buy signal, there will be no buy signal anymore before sell signal appears. I want code which enables another buy signal even if sell signal haven't appeared.

Could you help me modify this afl? I need this parameter for my stock screening:
  • Buy Signal: everytime RSI moves from below 60 to above 60
  • Sell Signal: everytime RSI moves from above 50 to below 50
 

johnnypareek

Well-Known Member
#10
HTML:
_SECTION_BEGIN("Price"); 
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C,
1 )) ));
Plot(C,"",1,128);
b =Optimize("Buy Trigger",Param("Buy Trigger",45,5,65,1),5,65,1);
s=Optimize("Sell Trigger",Param("Sell Trigger",55,1,40,1),1,90,1);
SetPositionSize( 50, spsShares ); // 50 shares by default

Buy=Cross(RSI(),b);
Sell=Cross(s,RSI());

//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy);
shape = Buy * shapeUpArrow +Sell * shapeDownArrow ;

PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );

enjoy
 

Similar threads