[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] Creating 50 EMA Above/Below Ratio



PureBytes Links

Trading Reference Links

pumrysh,

There are a couple of small errors in your code:
--8<----------
lookback:=100;
EMA:=Mov(C,50,E);
DaysAbove:=Sum(If(C>EMA,1,0),lookback);
DaysBelow:=Sum(If(C>EMA,1,0),lookback);
{These are the same value!}

Ratio:=DaysAbove/DaysBelow;
{prone to divide by zero errors}

Ratio;
--8<----------


As and alternative, try:

--8<----------
lookback:=10;
EMA:=Mov(C,50,E);
DaysAbove:=Sum(C>EMA,lookback);
DaysBelow:=Sum(C<EMA,lookback);
Ratio:=DaysAbove/Max(DaysBelow,1);
Ratio;
--8<----------


Cheers






------------------------ Yahoo! Groups Sponsor --------------------~--> 
You can search right from your browser? It's easy and it's free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/