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

[EquisMetaStock Group] Creating 50 EMA Above/Below Ratio



PureBytes Links

Trading Reference Links

bellamy_29m
            I think your suggestion is NOT a good idea.
If you do Ratio:=DaysAbove/Max(DaysBelow,1) and DaysBelow is "0" then
DaysAbove will be the result (no error) but it's not right!!!!!!!
The error shows the ratio is "infinity" and that is the true!!!!!
Zero division errors are not errors in the code.
Sometimes we MUST accept divisions are not possible :)
Regards,
          Pablo

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

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

b> Ratio;
b> --8<----------


b> As and alternative, try:

b> --8<----------
b> lookback:=10;   { should to be 100 }
b> EMA:=Mov(C,50,E);
DaysAbove:=Sum(C>>EMA,lookback);
b> DaysBelow:=Sum(C<EMA,lookback);
b> Ratio:=DaysAbove/Max(DaysBelow,1);
b> Ratio;
b> --8<----------


b> Cheers







 
b> Yahoo! Groups Links







Pablo Bozzolo

---
Contact info:

Movil: 221 5384617
E-mail: italoarg76@xxxxxxxx
MSN: italoarg76@xxxxxxxxxxx
ICQ: 77207033




------------------------ 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/