I want to filter stocks whose RSI between 70 and 30 in 15 min time frame for one day (0915 to 1530)

Hi,
I am new to AFL programming. Please help on this code.

I have created data set for complete 15 min rsi value but don't know how to filter complete day if RSI value goes above 70 or below 30 for complete day.

period = Param( "RSI period", 14, 2, 30, 1 );
TimeFrameSet( in15Minute ); // switch to 15 minute frame
SetChartOptions( 0, 0, ChartGrid30 | ChartGrid70 );

r = RSI( period );
//rHHV = RSI( period );
//rLLV = RSI( period );

Below70 = r < 70;
Above30 = r > 30;

grid_day = Day()!=Ref(Day(),-1);
Plot(grid_day,"",colorLightBlue,styleHistogram|styleDashed|styleNoLabel|styleOwnScale);

// Explore //
Filter = 1 ;
AddColumn( r , "RSI( " + period + ")" );

// Chart //
Plot( RSI( period ), "RSI( " + period + ") ", colorWhite );
Plot(30,"",colorLightGrey,styleDashed);
Plot(70,"",colorLightGrey,styleDashed);
Plot(100,"",colorBlack,styleDashed);
Plot(0,"",colorBlack,styleDashed);
PlotOHLC( r, r, 50, r, "", IIf( r > 50, colorRed, colorGreen ), styleCloud | styleClipMinMax, 30, 70 );
TimeFrameRestore();
/*

_SECTION_BEGIN("RSI between 70 and 30");

AddColumn( r, "RSI( " + period + ") " );
Buy = (RSI(14) > 68) AND Session;
Sell = (RSI(14) < 30 ) AND Session;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

_SECTION_END();*/

Data Set :
2019-03-21%2020_19_17-Book1%20-%20Excel

You should start with reading existing posts:

1 Like

Thanks and Sure , I will read this post and reply if i need help.