Hello,
Please help me writing a scan
there are two simple conditions
cond1=BBtop(minus)BBbot=less than 5
cond2=+DI(minus) -DI=greater than 5
Scan should return stocks that meet both the criteria
Attaching bollinger BBtop , BBbot, +DI and -DI for easy reference
_SECTION_BEGIN("bollinger");
SetChartOptions( 0,chartShowArrows|chartShowDates );
Filename = StrLeft(_DEFAULT_NAME(),StrLen( _DEFAULT_NAME())-2) ;
_N(Title = filename + StrFormat(" - {{INTERVAL}} {{DATE}} \nOpen %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +"
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", colorBlack, styleNoTitle | ParamStyle(" Style", styleCandle, maskAll) ); // shows all style options
P = ParamField(" Price field",-1);
Periods = Param("Periods" , 15, 2, 300, 1 );
Width = Param("Width" , 2, 0, 10, 0.05 );
Color = ParamColor(" Color", colorCycle );
Style = ParamStyle(" Style");
bbTop = BBandTop( P, Periods, Width );
bbBot = BBandBot( P, Periods, Width );
Buy = Low <= bbBot;
Sell = High >= bbTop;
Plot( bbTop, "\nBBTop" + _PARAM_VALUES( ), Color, styleLine );
Plot( bbBot, "\nBBBot" + _PARAM_VALUES( ), Color, styleLine );
PlotShapes(Buy * shapeUpArrow, colorGreen, 0, L, -10);
PlotShapes(Sell * shapeDownArrow, colorRed, 0, H, -10);
_SECTION_END();
_SECTION_BEGIN("ADX");
range = Param("Periods", 14, 2, 200, 1 );
Plot( ADX(range), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue ), ParamStyle("ADX style", styleThick ) );
Plot( PDI(range), "+DI", ParamColor( "+DI color", colorGreen ), ParamStyle("+DI style") );
Plot( MDI(range), "-DI", ParamColor( "-DI color", colorRed ), ParamStyle("-DI style") );
_SECTION_END();
Deepak Patade,
Nasik.