Hi,

A couple of things to look at:

1. Foreign takes one of "O" (open), "H" (high), "L" (low), "C" (close), "V" 
(volume), "I" (open Interest), and for v5.29 and above: "1" (aux1), "2" (aux2). 
It does NOT take "X".

2. By default, you must run a Scan to use AddToComposite. However, I notice 
that you are using Filter which applies to Exploration. If you want to use 
AddToComposite in an Exploration, you must add the flag atcFlagEnableInExplore.

3. When running the Scan/Exploration, make sure the current symbol is one that 
has a very long history (e.g. an index).

--- In [email protected], "James" <readsh...@...> wrote:
>
> 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