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

[EquisMetaStock Group] Re: Help needed in Exploration Code



PureBytes Links

Trading Reference Links

Khalid, try something like this:

==============
ColA: BarCount
==============
---8<----------------------------------------

{ Plots bar count (+/-) of Close above/below EMA
  http://www.metastocktools.com }

{ Variables: EMA periods }
pds:=50;

{ Indicators: EMA }
EMA:=Mov(C,pds,E);

{ 2nd EMA/cross defined bar }
init:=Cum(IsDefined(EMA))=2;

{ Bar count since Close above EMA }
up:=Cross(C,EMA);
upBars:=BarsSince(up OR init)+1;

{ Bar count since Close below EMA }
dw:=Cross(EMA,C);
dwBars:=BarsSince(dw OR init)+1;

{ Select count for up/down periods }
count:=If(C>=EMA,upBars,-dwBars);

{ Plot / exploration value }
0;count

---8<----------------------------------------


jose '-)
http://www.metastocktools.com




--- In equismetastock@xxxxxxxxxxxxxxx, "Khalid 
Masood" <dr_khalidmasood@xxx> wrote:
>
> I want an exploration to find the days elapsed of stocks below/above 
> 50 day exponential moving average. I tried following one, but it 
> simultaneously produces result showing both up day count and down day 
> count of each stock. Help me in correcting the code. Thanks in advance.
> 
> Col A: Above/50 DMA
> ===================
> x:=Cross(C,Mov(C,50,E));
> BarsSince(x)
> 
> Col B: Below/50 DMA
> ===================
> y:=Cross(Mov(C,50,E),C);
> BarsSince(y)





 
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

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