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

[EquisMetaStock Group] Re: Please check my formula



PureBytes Links

Trading Reference Links


The problem here is probably neither the software nor the hardware - 
check the "middleware", the interface between the two.  :)

When using the Security() function, make sure that there is sufficient 
data in the referenced securities to match the loaded chart data, 
otherwise errors will follow.  One way around this is to restrict the 
processing to the common valid data period as done here:

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

Sec1:=Security("C:\MetaStock\Data\cbavp",C);
Sec2:=Security("C:\MetaStock\Data\cbavc",C);

SMA1:=Mov(Sec1,3,S);
SMA2:=Mov(Sec2,3,S);

valid:=Cum(IsDefined(SMA1+SMA2))>0;

same:=valid AND
   (SMA1>Ref(SMA1,-1) AND SMA2>Ref(SMA2,-1)
 OR SMA1=Ref(SMA1,-1) AND SMA2=Ref(SMA2,-1)
 OR SMA1<Ref(SMA1,-1) AND SMA2<Ref(SMA2,-1));

{ +1= 100% correlation, -1= 0% correlation }
same

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


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



--- In equismetastock@xxxxxxxxxxxxxxx, "chellester2002" <rego2@xxxx> 
wrote:
> 
> What I'm trying to do is compare patterns, when two securities are 
> doing the same or opposite things to each other - so that if they
> are both moving in the same direction I get a signal, or if they are 
> moving converse I get a signal, and then I want it to display 
> whatever the last signal was till it changes again - I think what 
> I've done should be correct, but everytime I finish editing the 
> indicator builder and close it, I just get a blank section with no 
> lines or anything, or metastock crashes (running MetaStock Pro 7.2) 
- 
> I know it doesn't specially like using the PREV function, but I 
> thought it should be able to handle it - unless I've done something 
> wrong.  Any ideas what my problem might be - my formula, or my 
> hardware??
> Thanks for your help
> 
> bob:=Security("C:\MetaStock\Data\cbavp", C);
> bill:=Security("C:\MetaStock\Data\cbavc",C);
> 
> bob3:=Mov(bob,3,S);
> bill3:=Mov(bill,3,S);
> 
> sim:=((bill3<Ref(bill3,-1) AND Ref(bill3,-1)<Ref(bill3,-2) AND Ref
> (bill3,-2)<Ref(bill3,-3)) AND (bob3<Ref(bob3,-1) AND Ref(bob3,-1)
<Ref
> (bob3,-2) AND Ref(bob3,-2)<Ref(bob3,-3))) 
> OR 
> ((bill3>Ref(bill3,-1) AND Ref(bill3,-1)>Ref(bill3,-2) AND Ref(bill3,
-
> 2)>Ref(bill3,-3)) AND (bob3>Ref(bob3,-1) AND Ref(bob3,-1)>Ref(bob3,-
> 2) AND Ref(bob3,-2)>Ref(bob3,-3)));
> 
> mirr:=((bill3<Ref(bill3,-1) AND Ref(bill3,-1)<Ref(bill3,-2) AND Ref
> (bill3,-2)<Ref(bill3,-3)) AND (bob3>Ref(bob3,-1) AND Ref(bob3,-1)
>Ref
> (bob3,-2) AND Ref(bob3,-2)>Ref(bob3,-3)))
> OR 
> ((bill3>Ref(bill3,-1) AND Ref(bill3,-1)>Ref(bill3,-2) AND Ref(bill3,
-
> 2)>Ref(bill3,-3)) AND (bob3<Ref(bob3,-1) AND Ref(bob3,-1)<Ref(bob3,-
> 2) AND Ref(bob3,-2)<Ref(bob3,-3)));
> 
> If(mirr<>1 AND sim<>1,PREV,If(mirr=1,1,2))





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/