Exploration to find all stocks which are trading above 200 day EMA & stochastic <= 20

Dear All,

I need an exploration to find all stocks which are trading above the 200 day EMA & also the stochastic should be <= 20. My Stochastic settings in the chart are as follows: Stochastic %D(8,3,3) and Stochastic %K(8,3).

Do help me out....I tried myself but was not successful.

Regards,

kindly post your coding attempt. The objective of the Forum is to help others learn and be independent otherwise you could just google and get many AFLs with the exact code that your looking for.

1 Like

OK Travick ..I will post my code withen a few mins

EMAvg200 = EMA(C,200);
shD = StochD(8,3,3);
shK = StochK(8,3);

BC = EMAvg200 AND shD <=20 AND shk <= 20;

Filter = BC;

AddColumn(C,"Close",1.2);
AddColumn(EMAvg200,"EMA200",1.2);
AddColumn(shD,"SHD",1.2);
AddColumn(shK,"SHK",1.2);

Replace

BC = EMAvg200 AND shD <=20 AND shk <= 20;

with

BC = C > EMAvg200 AND shD <=20 AND shk <= 20;

Or similar ones.

You have to assign arrays to Filter returning true or false. If you assign just EMA then it is not checking for above/below MA because values of EMA of price are always greater than zero (as aside AFL Null is not the same as zero). Instead you have to add check of price against EMA -> C > EMA.

Additionally read here about more detailed explanation

1 Like