I wrote the script below to count the number of stocks whose 100 day MA is 
above their 300 day MA.  It seems to mostly work except for about 100 days 
where it shows the number of stocks is equal to 0.  The same days show the 
number of stocks for the inverse is 0.  Furthermore I can see there are stocks 
whose 100 day MA are above or below their 300 day MA on these days.  What am I 
doing wrong?  Thank you in advance.

FastMALength = 100;                                                             
                        //Set Fast Moving Average
SlowMALength = 300;                                                             
                        //Set Slow Moving Average

FastMA = DEMA(Close, FastMALength);                                             
        //Fast Moving Average
SlowMA = DEMA(Close, SlowMALength);                                             
        //Slow Moving Average

AddToComposite(IIf(FASTMA > SlowMA, 1, 0), "~DEMA_Bull", "X");



Buy=Sell=Short=Cover=0;
Filter=1;

Bull = Foreign("~DEMA_Bull", "X");
Plot(Bull, "Bull", 1,1);

Filter=1;

Reply via email to