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

[amibroker] Re: metastock statement to afl



PureBytes Links

Trading Reference Links

Rick
You are right it is Tom Demark formula that I am trying to 
convert ... 
I got the first part exactly just like you did, but I was not sure 
how to go about the statement in question.  

Thanks a bunch for your Help;




"I'll be back"  :)




--- In amibroker@xxxxxxxxxxxxxxx, Rick Osborn <ricko@xxx> wrote:
>
> oops
> I see that the line for TD4 should be
> 
> TD4 = IIf(TD2==1 AND TD3==1,1,0); 
> 
> Rick
> --- Rick Osborn <ricko@xxx> wrote:
> 
> > I'll have a go at it.
> > 
> > The Fml("TD - SetUp-Buy" ) is a Tom Demark formula
> > which, I think translated to AB is as follows.
> > 
> > TD1=IIf(C<Ref(C,-4),1,0); 
> > 
> > TD2 = IIf(TD1==1 AND Ref(TD1,-1)==1 AND
> > Ref(TD1,-2)==1
> > AND Ref(TD1,-3)==1 AND 
> >       Ref(TD1,-4)==1 AND Ref(TD1,-5)==1 AND
> > Ref(TD1,-6)==1 AND Ref(TD1,-7)==1 AND 
> >       Ref(TD1,-8)==1, 1,0); 
> > 
> > TD3 = IIf(Ref(C,-9)>=Ref(C,-13),1,0); 
> > 
> > TD4 = IIf(TD2=1 AND TD3=1,1,0); 
> > 
> > TD5 = IIf(H>=Ref(LLV(L,5),-3),1,0); 
> > 
> > D8 = IIf(Ref(TD4,1)==1 AND TD5==1,1,0); 
> > 
> > D9 = IIf(TD4==1 AND TD5==1 AND Ref(D8,-1)!= 1,1,0); 
> > 
> > D10 = IIf(Ref(TD4,-1)==1 AND TD5==1 AND
> > Ref(D8,-2)!=1
> > AND Ref(D9,-1)!=1,1,0); 
> > 
> > D11 = IIf(Ref(TD4,-2)==1 AND TD5==1 AND
> > Ref(D8,-3)!=1
> > AND Ref(D9,-2)!=1 AND 
> >       Ref(D10,-1)!=1,1,0); 
> > 
> > D12 = IIf(Ref(TD4,-3)==1 AND TD5==1 AND
> > Ref(D8,-4)!=1
> > AND Ref(D9,-3)!=1 AND 
> >       Ref(D10,-2)!=1 AND Ref(D11,-1)!=1,1,0); 
> > 
> > D13 = IIf(Ref(TD4,-4)==1 AND TD5==1 AND
> > Ref(D8,-5)!=1
> > AND Ref(D9,-4)!=1 AND 
> >       Ref(D10,-3)!=1 AND Ref(D11,-2)!=1 AND
> > Ref(D12,-1)!=1,1,0); 
> > 
> > D14 = IIf(Ref(TD4,-5)==1 AND TD5==1 AND
> > Ref(D8,-6)!=1
> > AND Ref(D9,-5)!=1 AND 
> >       Ref(D10,-4)!=1 AND Ref(D11,-3)!=1 AND
> > Ref(D12,-2)!=1 AND Ref(D13,-1)!=1,1,0); 
> > 
> > D15 = IIf(Ref(TD4,-6)==1 AND TD5==1 AND
> > Ref(D8,-7)!=1
> > AND Ref(D9,-6)!=1 AND 
> >       Ref(D10,-5)!=1 AND Ref(D11,-4)!=1 AND
> > Ref(D12,-3)!=1 AND Ref(D13,-2)!=1 AND 
> >       Ref(D14,-1)!=1,1,0); 
> > 
> > D16 = IIf(Ref(TD4,-7)==1 AND TD5==1 AND
> > Ref(D8,-8)!=1
> > AND Ref(D9,-7)!=1 AND 
> >       Ref(D10,-6)!=1 AND Ref(D11,-5)!=1 AND
> > Ref(D12,-4)!=1 AND Ref(D13,-3)!=1 AND 
> >       Ref(D14,-2)!=1 AND Ref(D15,-1)!=1,1,0); 
> > 
> > D17 = IIf(Ref(TD4,-8)==1 AND TD5==1 AND
> > Ref(D8,-9)!=1
> > AND Ref(D9,-8)!=1 AND 
> >       Ref(D10,-7)!=1 AND Ref(D11,-6)!=1 AND
> > Ref(D12,-5)!=1 AND Ref(D13,-4)!=1 AND 
> >       Ref(D14,-3)!=1 AND Ref(D15,-2)!=1 AND
> > Ref(D16,-1)!=1,1,0); 
> > 
> > SetUp = D8+D9+D10+D11+D12+D13+D14+D15+D16+D17; 
> > 
> > Then the code to convert the rest is 
> > 
> > value = Cum(IIf(C<Ref(Close,-2),1,0)) -
> > ValueWhen(Ref(SetUp,-1)==1,
> > Cum(IIf(C<Ref(C,-2),1,0)));
> > 
> > BUT there is the Ref function seems to refer to the
> > future.  I changed it to Ref(value, -1).  
> > 
> > Maybe somebody should check this.
> > Hope it helps
> > 
> > Rick
> > --- aboaziz_sa <aboaziz_sa@xxx> wrote:
> > 
> > > Cum(If(C<Ref(CLOSE,-2),1,0)) -
> > > ValueWhen(1,Ref(Fml("TD - SetUp-Buy" ), 
> > > 1)=1,
> > > Cum(If(C<Ref(C,-2),1,0)))
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Could some one help convert the above  metastock
> > > statement to afl
> > > 
> > > Thanks
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > Rick Osborn & Associates
> > 885 Sorrento Ave.
> > Oshawa, Ontario L1J 6V6
> > (905) 728-8543  fax 728-0815
> > 
> > 
> 
> 
> Rick Osborn & Associates
> 885 Sorrento Ave.
> Oshawa, Ontario L1J 6V6
> (905) 728-8543  fax 728-0815
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

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

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

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

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