How to do this

chintan786

Well-Known Member
#1
Hi all , I want to scan stcks which are 15% near to their new highs -- lows and 10% near to their 200DMA or EMA .... can anyone tell me how to this in Amibroker.

thanks in Advance

Chintan
 

KelvinHand

Well-Known Member
#2
Hi all , I want to scan stcks which are 15% near to their new highs -- lows and 10% near to their 200DMA or EMA .... can anyone tell me how to this in Amibroker.

thanks in Advance

Chintan

Hi,
Try this:

//--- Begin ----
/*
Scan for 15% Near New High AND New Low AND 10% Near EMA200
Script derived from "Scan New High and New Low" of the website:
http://www.amibroker.com/library/detail.php?id=1106

and modified for this purpose

*/

//--User Input

YMWD = ParamList("Choose scan by", "Day|Week|Month", 1);
Wk = Param("New Week Hi/Lo", 52, 1, 52);
Mth = Param("New Month Hi/Lo", 12, 1, 12);
Days = Param("New Day Hi/Lo", 260, 1, 260);

if (YMWD == "Week")
{
x = Wk;
Days = 5*wk;
}
else
if (YMWD == "Month")
{
x = Mth;
Days = 20*Mth;
}
else
{
x = Days;
}


CurNewHigh = Ref(HHV(High,Days),-1);
CurNewLow = Ref(LLV(Low,Days),-1);

EMA200 = EMA(C, 200);
NearEMA200 = C >0.90*EMA200 AND C<1.1*EMA200; //--10%
NearNewHigh = C >0.85*CurNewHigh AND C <1.15* CurNewHigh;
NearNewLow = C >0.85*CurNewLow AND C <1.15* CurNewLow;
Buy = NearNewHigh AND NearEMA200;
Sell = NearNewLow AND NearEMA200;


Filter = (Buy OR Sell);

AddTextColumn(FullName(), "Security", 1.0, colorDefault, colorDefault,200);
AddTextColumn( WriteIf(Buy, "Near New High", WriteIf(Sell, "Near New Low", "")),
"New High/Low",
1.2, colorDefault, colorDefault,100);

//--- End -----