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

Re: [amibroker] Re: Demark Sequential



PureBytes Links

Trading Reference Links

Hello,

stephane

Title= " Td seq I";
/*TD seq long et short side full version*/

/********Optimize***********/
Opt1=Param("Opt1",9,5,21,1);
Opt2=Param("Opt2",13,1,21,1);

/*********Setup Buy*********/
TD1=IIf(Close<Ref(Close,-4),1,0);
TD2=IIf(BarsSince(BarsSince(TD1))==Opt1, 1,0); //Sum(TD1,9)==9;
TD3= Ref(H,-1)>=Ref(LLV(L,Opt1-4),-3);
TD4= Ref(C,-Opt1)>=Ref(C,-Opt2);
SetupBuy= TD3 AND TD2 AND TD4;

/***********SetupSell************/
TD1=IIf(Close>Ref(Close,-4),1,0);
TD2=IIf(BarsSince(BarsSince(TD1))==Opt1, 1,0);
TD3= Ref(L,-1)<=Ref(HHV(H,Opt1-4),-3);
TD4= Ref(C,-Opt1)<=Ref(C,-Opt2);
SetupSell= TD3 AND TD2 AND TD4 ;

/*********Count Buy ********/
CountBuy= Sum(IIf(C<Ref(C,-2),1,0),BarsSince(SetupBuy));
//or C<Ref(H,-2)

/*********Count Sell ********/
CountSell= Sum(IIf(C>Ref(C,-2),1,0),BarsSince(SetupSell));
//or C>Ref(L,-2)

/***********A***********/
B1= CountBuy >=Opt2;
B1= Hold(B1==0,2) AND B1;
Timing=(BarsSince(SetUpbuy)< BarsSince(SetUpsell));
Ccount=IIf(CountBuy >=Opt2,ValueWhen(B1,HHV(C,BarsSince(SetupBuy))),Null);
Hsetup=IIf(CountBuy >=Opt2,ValueWhen(SetupBuy,HHV(H,Opt1)),Null);
BuyA=B1 AND Timing AND Hsetup > Ccount;

/******B**********/
B2= CountBuy >Opt2 AND Close > Ref(Close,-4);
B2=Hold(B2==0,2) AND B2;
B2=ExRem(B2,B1);
BuyB=B2  AND Timing  AND Hsetup > Ccount;

/*************C***********/
B3= CountBuy >Opt2 AND Close > Ref(High,-2);
B3= Hold(B3==0,2) AND B3;
B3=ExRem(B3,B1);
BuyC= B3  AND Timing  AND Hsetup > Ccount;

/************Buy Signal********/
Buy=BuyB OR BuyC  ;

////////////////////////////////
//SHORT
/////////////////////////////////

/***********A***********/
S1= CountSell >=Opt2;
S1= Hold(S1==0,2) AND S1;
Timing=(BarsSince(SetUpSell)< BarsSince(SetUpbuy));
Ccount=IIf(CountSell >=Opt2,ValueWhen(S1,LLV(C,BarsSince(SetupSell))),Null);
Lsetup=IIf(CountSell >=Opt2,ValueWhen(SetupSell,LLV(L,Opt1)),Null);
SellA=S1 AND Timing AND Lsetup < Ccount;

/******B**********/
S2= CountSell >Opt2 AND Close < Ref(Close,-4);
S2=Hold(S2==0,2) AND S2;
S2=ExRem(S2,S1);
SellB=S2  AND Timing  AND Lsetup < Ccount;

/*************C***********/
S3= CountSell >Opt2 AND Close < Ref(Low,-2);
S3= Hold(S3==0,2) AND S3;
S3=ExRem(S3,S1);
SellC= S3  AND Timing  AND Lsetup < Ccount;

/***********Short Signal********/
Short= SellB OR SellC  ;

Plot(C,"",IIf(Short,colorYellow,IIf(Buy,colorGreen,1)),64);

PlotShapes(IIf(Short,
shapeDownArrow,shapeNone),colorYellow,0,H,-10);
PlotShapes(IIf(Buy,
shapeUpArrow,shapeNone),colorGreen,0,L,-10);

PlotShapes(IIf(SetupSell,
shapeDigit9,shapeNone),colorRed,0,H,20); 
PlotShapes(IIf(SetupBuy,
shapeDigit9,shapeNone),colorBlue,0,L,-20);

> Has anyone been able to program the Demark sequential as a buy/sell
> program for Amibroker backtesting?
>
> Thanks,
>
> Paul
>
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> wrote:
> > Here is the [verbatim] translation of the code
> > CL=C;
> > CL1=Ref(C,-1);
> > CL2=Ref(C,-2);
> > CL3=Ref(C,-3);
> > CL4=Ref(C,-4);
> > CL5=Ref(C,-5);
> > CL6=Ref(C,-6);
> > CL7=Ref(C,-7);
> > CL8=Ref(C,-8);
> > CL9=Ref(C,-9);
> > CL10=Ref(C,-10);
> > CL11=Ref(C,-11);
> > CL12=Ref(C,-12);
> > LO7=Ref(L,-7);
> > LO8=Ref(L,-8);
> > LO9=Ref(L,-9);
> > S1=
> > ((CL < CL3) AND (CL1 < CL4) AND (CL2 < CL5) AND (CL3 < CL6) AND (CL4
> > < CL7) AND (CL5 < CL8) AND (CL6 < CL9) AND (CL7 < CL10) AND (CL8 <
> > CL11) AND (CL9 < CL12)) AND ((LO7 < CL6) OR (LO8 < CL6) OR (LO9 <
> > CL6));
> > Plot(C,"C",1,64);
> > PlotShapes(shapeUpTriangle*S1,5);
> > S2=Sum(C<Ref(C,-3),10)==10 AND ((Ref(L,-7) < Ref(C,-6)) OR (Ref(L,-8)
> > < Ref(C,-6)) OR (Ref(L,-9) < Ref(C,-6)));
> > PlotShapes(shapeDownTriangle*S2,4);
> > //http://www.linnsoft.com/scans/tdSequentialSetup.htm
> >
> > And here is the beauty [and the power] of AFL structure : You will
> > have the same result with
> >
> > S2=Sum(C<Ref(C,-3),10)==10 AND ((Ref(L,-7) < Ref(C,-6)) OR (Ref(L,-8)
> > < Ref(C,-6)) OR (Ref(L,-9) < Ref(C,-6)));
> > Plot(C,"C",colorBlack,64);
> > PlotShapes(shapeUpTriangle*S2,colorBrightGreen);
> >
> > The signal matches with  bearish conditions.
> > Try in your AA the exploration
> >
> > S2=Sum(C<Ref(C,-3),10)==10 AND ((Ref(L,-7) < Ref(C,-6)) OR (Ref(L,-8)
> > < Ref(C,-6)) OR (Ref(L,-9) < Ref(C,-6)));
> > Plot(C,"C",colorBlack,64);
> > PlotShapes(shapeUpTriangle*S2,colorBrightGreen);
> > Filter=1;
> > AddColumn(BarsSince(S2),"");
> >
> > The majority of N100 stocks has not given any signal for the last 100
> > bars.
> > On the other side, some signals were quite accurate to catch the
> > change of the trend.
> > Dimitris Tsokakis
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> > wrote:
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "jmbruegge" <jmbruegge@xxxx>
> > wrote:
> > > > Thanks Dimitris - I found some of the links you pointed out, I
> > have
> > > > to admit I am very new to Amibroker and am just starting to
> > explore
> > > > formula writing. One of the technicians I follow closely is a big
> > > > believer in Tom Demark, and the technician I follow has been
> > right
> > > on
> > > > the money for the last few years - Amibroker is a great program
> > and
> > > I
> > > > am very satisfied with it. I do not think I can simply use the
> > same
> > > > formula from the Linnsoft link you gave me and apply it to
> > > Amibroker
> > > > can I ?? (I know, what a dumb question!)
> > >
> > > No, you can not paste it as is, it is written in some different
> > > language. All these C1, C2 etc are respective previous C values.
> > > In AFL they are expressed through the Ref() function, ie
> > > C1=Ref(C,-1);
> > > C2=Ref(C,-2);
> > > etc.
> > > Since you begin, it would be interesting to give it a try.
> > > Of course, the Linnsoft code is quite complicated [I don't know if
> > it
> > > is the language or the author].
> > > I'm far from the office now, it is midnight here in [hot] Athens.
> > > I will post detailed AFL code tomorrow morning.
> > > The Demark method was giving some main turning points the ultra-
> > > bearish years 2000 till 2002. It is almost without signal the whole
> > > 2003 for the majority of Nasdaq 100 stocks, the character of the
> > > market has changed.
> > > Anyway, you will have your observations and results.
> > > Dimitris Tsokakis
> > > >
> > > > Have you or anyone else come across an already pre-written
> > formula
> > > > code for TD Sequential or TD Combo anywhere that I can apply
> > > directly
> > > > into Amibroker ?? Thanks in advance - JMB
> > > >
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
> > > <TSOKAKIS@xxxx>
> > > > wrote:
> > > > > 206 references come out from
> > > > > http://search.yahoo.com/search?
> > > > > x=op&vp=TD+Sequential+&vp_vt=any&vst=0&vd=all&fl=0&ei=ISO-8859-
> > > > > 1&vm=p&n=20
> > > > > Dimitris Tsokakis
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "jmbruegge" <jmbruegge@xxxx>
> > > > wrote:
> > > > > > Has ANYONE on this board written or come across the Amibroker
> > > > > > formula for TD Sequential or TD Combo by Tom Demark - I am
> > > > > searching
> > > > > > everywhere.
> > > > > >
> > > > > > Thank you -
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here 
> <http://us.ard.yahoo.com/SIG=1292lnbvj/M=295196.4901138.6071305.3001176/D=groups/S=1705632198:HM/EXP=1096132383/A=2128215/R=0/SIG=10se96mf6/*http://companion.yahoo.com> 
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/amibroker/
>        
>     * To unsubscribe from this group, send an email to:
>       amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
>
>
> __________ NOD32 1.876 (20040924) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.nod32.com




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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