Dear Experts,
I am testing a strategy & created a very basic AFL but it is not yielding the desired results during scan. May be I am doing something wrong so need help.
Here are buy conditions:
Buy - When monthly & weekly RSI are already above 60 and daily RSI crosses above 60
Exit/sell - When daily RSI closes below 60
Short -When monthly & weekly RSI are already below 40 and daily RSI crosses below 40
Exit/Cover - When daily RSI closes above 40
Here is the code which I want to scan and backtest on 15 years data but not getting desired results. Please help. Thanks a ton in advance.
_SECTION_BEGIN("RSI");
TimeFrameSet( inMonthly ); // switch to Monthly
R1 = RSI (14);
OverBought = R1 > 60;
OverSold = R1 < 40;
TimeFrameRestore(); // restore time frame to original
TimeFrameSet( inWeekly ); // switch to Weekly
R2 = RSI (14);
OverBought = R2 > 60;
OverSold = R2 < 40;
TimeFrameRestore(); // restore time frame to original
TimeFrameSet( inDaily ); // switch to Daily
R3 = RSI (14);
OverBought = R3 > 60;
OverSold = R3 < 40;
TimeFrameRestore(); // restore time frame to original
Filter = 1;
AddColumn( R1, "RSI Monthly" );
AddColumn( R2, "RSI Weekly" );
AddColumn( R3, "RSI Daily" );
_SECTION_END();
Buy = R1>60 AND R2>60 AND Cross(R3,60);
Sell=R1<40 AND R2<40 AND Cross(60,R3);