How to scan n% up or down stocks

singhboy

Active Member
#1
Hi guys, i dont knw how to put my question exactly in simple words so i give u example. I like to trade in stocks which hav huge 2 days range, means huge diff betwwen high n low of last 2 days. So i use this afl to scan for such stocks at evening on eod data n choose them for next day intra trading.
H = HHV(H, 2) ;

L = LLV(L, 2) ;
R= H-L;


SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);


Filter = R>30 AND C>300 AND C< 400 AND V > 150000 ;

now R is the diff between high n low of last 2 days. Instead of editing R, n Close prices i.e C every time , it would b better if i just write like this
Filter = R> 10% AND C > 200 AND V=150000 :
but writing R> 10% doesnt work. So i hav to edit R every time wen i keep going up with C. ex
Filter= R>40 and C>400 and C<500
so pls tell me wats the syntex used for %age in alfs so that i put it with R n scan all stocks of that range at same time rather tahn editing R n C everytime. Thanks
 
#2
Hi guys, i dont knw how to put my question exactly in simple words so i give u example. I like to trade in stocks which hav huge 2 days range, means huge diff betwwen high n low of last 2 days. So i use this afl to scan for such stocks at evening on eod data n choose them for next day intra trading.
H = HHV(H, 2) ;

L = LLV(L, 2) ;
R= H-L;


SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);


Filter = R>30 AND C>300 AND C< 400 AND V > 150000 ;

now R is the diff between high n low of last 2 days. Instead of editing R, n Close prices i.e C every time , it would b better if i just write like this
Filter = R> 10% AND C > 200 AND V=150000 :
but writing R> 10% doesnt work. So i hav to edit R every time wen i keep going up with C. ex
Filter= R>40 and C>400 and C<500
so pls tell me wats the syntex used for %age in alfs so that i put it with R n scan all stocks of that range at same time rather tahn editing R n C everytime. Thanks
///////////////////////////////////////////////////////////////////////////////////
Perhaps this is what u want--
What u need to do is to explore in 2 day Time Frame. Create 2 day Time Frame thru Preferances>Intraday.


/////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("2 day range");

SetChartOptions(0,chartShowArrows|chartShowDates);
PlotOHLC(O, H, L, C, "Close", colorLightGrey, styleBar);
R= H-L;

CondR=R>1.2*EMA(R,10);//Range higher than 20% of 10 day EMA of Range.You can vary both if u like

PlotShapes(IIf(CondR, shapeSquare, shapeNone),colorYellow, 0, L, Offset=-40);


Filter = CondR AND C > 200 AND V>150000;



AddTextColumn(Name(), "Symbol");

AddColumn(R/EMA(R,10), "EMAR10", 1.2);

_SECTION_END();
 

singhboy

Active Member
#3
No dear, my afls is working fine, i just want the syntax used for %age in writing afls. For ex
Filter = R>10* AND C>200 AND V > 50000 ;
Filter = R>10% AND C>200 AND V > 50000 ;
both of these dont work, so wats the appropriate syntax for %age.
 

singhboy

Active Member
#4
Ok finally I made it
H = HHV(H, 2) ;

L = LLV(L, 2) ;
R= H-L;


SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);


Filter = R >= HHV(H, 2) * 0.10
AND C>150 AND V > 150000 ;


Now Im up with another question with another afl. I use following afl to explore stocks which made new 4 day high.
H4 = HHV(H, 4) == H;

R= C-H;

Filter = H4;



SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);


Filter = H4 AND V > 100000 AND (ROC(C, 1) > 1) AND C > 200 AND C<19000;

Now on evening I want only those stocks in exploration which closed near highest price. For ex stock made high 432, n closed 429 ( i.e difference in highest high n close should b less than 1%). So pls help modifying afl. Thnx alot
 

columbus

Well-Known Member
#6

singhboy

Active Member
#8
H = HHV(H, 4) ;

R= C-H;

Filter = H4;



SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);

;
Filter = V > 100000 AND R<.005*C AND C > 200;

When I use this afl during mkt time by selecting periodicity as "Daily", it shows those stocks which making new 5 day high today. But i want only last 4 days in exploration reults. Like suppose high of last 4 days 520, n todays high 530. When stock will b 528, it will show in exploration results, which i dont want. I want it only when price is within the range of last 4 days, i.e 518. Pls modify abv afl
 
#9
We can write a complex script to make it work for both EOD run and during market hours. Or just go with 2 different scripts. One for EOD run (the one written by you) and another for during market run as given below.

H = HHV(H, 4) ;

R= C-H;

Filter = H4;



SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);

;
Filter = ref(V,-1) > 100000 AND ref(R,-1)<.005*C AND ref(C,-1) > 200;
 

singhboy

Active Member
#10
We can write a complex script to make it work for both EOD run and during market hours. Or just go with 2 different scripts. One for EOD run (the one written by you) and another for during market run as given below.

H = HHV(H, 4) ;

R= C-H;

Filter = H4;



SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);

;
Filter = ref(V,-1) > 100000 AND ref(R,-1)<.005*C AND ref(C,-1) > 200;
Thanks dear, I was trying something like Ref(HHV(H,-4) :lol: but that didnt work. I will try ur afl. Thnx again
 

Similar threads