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

Re: [amibroker] Re: Example of buying top N stocks ranked by some metric - no takers?



PureBytes Links

Trading Reference Links

Dimitris,

"...My intension was to present some AFL techniques, not to cover 
this [vast] EW story. I hope it was clear from the beginning."

Absolutely clear AND appropriate!  This has been EXACTLY the kind of 
guidance I was hoping to participate in. You've done a marvelous job 
of teaching 'technique' to me (and certainly others as well).  In 
general, I'm a pretty proficient programmer myself (with VB, assembly 
languages, etc.), but I'm relatively new to AmiBroker and still on 
the 'learning curve' for becoming proficient with the AFL language.  
I best learn by example, and it only takes one good 'prototype' 
example for me to 'get the idea'.  This EW exercise has been a 
perfect task to learn from, and your intention has been well served.  
I'll now be able to program and create the EW-oriented design I 
envision and want to explore.  Your 'foundation' has been extremely 
helpful!


"... It is important to make the code shorter, especially if you go to
more detailed EW analysis."

Yes, I definitely agree!  And this would apply to almost ANY 
application of significant complexity.  Hence, any 'shortcut' and 
efficient coding methods are quite welcomed.... 


Just a brief question regarding the latest code modification:  is 
there any reason to prefer "EnableScript("Jscript");" 
over "EnableScript("VBscript");"?  Could using 'VBscript' work just 
as well?


"... I think my contribution is complete at this point."

Yes!  You've done FAR MORE than what I expected, and I am SO grateful 
for this.  I have really learned a great deal from your 'prototype' 
implementation and presentation.  Again, thank you SO, SO MUCH for 
your sharing and help with this EW exercise.  You are ONE GREAT 
GUY!!!  (;->)

Buzz

----------------
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> Instead of writing definitions
> EP1=...
> EP2=...
> EP3=...
> etc, etc
> we may use the recent method of dynamic variables.
> It will be great to use it if you try more detailed EW analysis.
> [just imagine 30 definitions for EP, 30 for TP, 30 for ET and 30 
for 
> TT !!]
> Here is the application for my EW8
> 
> EnableScript("Jscript"); 
> <% 
> function CreateDynVar( Varname, Varval ) 
> { 
> AFL( Varname ) = Varval; 
> } 
> %>
> scr=GetScriptObject();
> X=BarIndex(); p=Param("p",5,5,30,1);z=Zig(C,p);Plot(C,"C",1,64);
> CONDP=PeakBars(C,P)==0;SP=Cum(CONDP);
> //Define EP1 to EP4 and TP1 to TP4
> for(i = 1;i<=4;i=i+1)
> {
> scr.CreateDynVar("EP"+i,ValueWhen(CONDP,C,i));  
> scr.CreateDynVar("TP"+i,ValueWhen(CONDP,X,i));  
> }
> CONDT=TroughBars(C,P)==0;ST=Cum(CONDT);
> //Define ET1 to ET5 and TT1 to TT5
> for(j=1;j<=5;j++)
> {
> scr.CreateDynVar("ET"+j,ValueWhen(CONDT,C,j));  
> scr.CreateDynVar("TT"+j,ValueWhen(CONDT,X,j));  
> }
> // EW definition
> EW8=EP3>EP4 AND EP2>EP3 AND EP2>EP1 AND ET4>ET5 AND ET3>ET2 AND 
> ET2>ET1 AND ET3>ET4 AND ET4>ET5 AND CONDT;
> COLOR=colorIndigo;
> PlotShapes(shapeDigit8*EW8,color);
> G=Cum(CONDP OR CONDT);
> GEW=SelectedValue(ValueWhen(EW8,G));
> //Plot the EW counter
> for(n=1;n<=9;n++)
> {
> PlotShapes((49-(2*n-(n%2)))*(G==GEW-n AND (n%2)*CONDP+(-1+n%2)
> *CONDT),Color);
> }
> Plot(EW8,"",colorPink,2+styleOwnScale);
> Plot(z,"",colorYellow,styleThick);
> Filter=EW8;// explore for all quotations
> AddColumn(C,"C");
> GraphXSpace=8;
> 
> This important technique [another Tomasz valuable offer !!] will 
help 
> to organize things better and not to be lost in the ocean of EW 
> details...
> I think my contribution is complete at this point.
> Dimitris Tsokakis
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> 
> wrote:
> > Buzz,
> > You may replace now all the Plotshapes lines with a single loop.
> > The new shorter code will be
> > 
> >  X=BarIndex(); 
> > p=Param("p",5,5,30,1);
> > z=Zig(C,p);Plot(C,"C",1,64);
> > CONDP=PeakBars(C,P)==0;SP=Cum(CONDP);
> > EP1=ValueWhen(CONDP,C,1);TP1=ValueWhen(CONDP,X,1);  
> > EP2=ValueWhen(CONDP,C,2);TP2=ValueWhen(CONDP,X,2); 
> > EP3=ValueWhen(CONDP,C,3);TP3=ValueWhen(CONDP,X,3); 
> > EP4=ValueWhen(CONDP,C,4);TP4=ValueWhen(CONDP,X,4); 
> > CONDT=TroughBars(C,P)==0;ST=Cum(CONDT);
> > ET1=ValueWhen(CONDT,C,1);TT1=ValueWhen(CONDT,X,1); 
> > ET2=ValueWhen(CONDT,C,2);TT2=ValueWhen(CONDT,X,2); 
> > ET3=ValueWhen(CONDT,C,3);TT3=ValueWhen(CONDT,X,3); 
> > ET4=ValueWhen(CONDT,C,4);TT4=ValueWhen(CONDT,X,4); 
> > ET5=ValueWhen(CONDT,C,5);TT5=ValueWhen(CONDT,X,5); 
> > // EW definition
> > EW8=EP3>EP4 AND EP2>EP3 AND EP2>EP1 AND ET4>ET5 AND ET3>ET2 AND 
> > ET2>ET1 AND ET3>ET4 AND ET4>ET5 AND CONDT;
> > COLOR=colorIndigo;
> > PlotShapes(shapeDigit8*EW8,color);
> > G=Cum(CONDP OR CONDT);
> > GEW=SelectedValue(ValueWhen(EW8,G));
> > for(n=1;n<=9;n++)
> > {
> > PlotShapes((49-(2*n-(n%2)))*(G==GEW-n AND (n%2)*CONDP+(-1+n%2)
> > *CONDT),Color);
> > }
> > Plot(EW8,"",colorPink,2+styleOwnScale);
> > Plot(z,"",colorYellow,styleThick);
> > Filter=EW8;// explore for all quotations
> > AddColumn(C,"C");
> > GraphXSpace=8;
> > 
> > [I added a hollow asterisk before the 0 to 8 sequence] 
> > It is important to make the code shorter, especially if you go to 
> > more detailed EW analysis .
> > Other shorte codes will follow.
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
> <TSOKAKIS@xxxx> 
> > wrote:
> > > Buzz,
> > > Here is a slight [but interesting] modification to see the 
> > historical 
> > > 0-to-8 EW digits.
> > > Put your cursor after an "8" of the past and the 0-to-7 
sequence 
> > will 
> > > move there !
> > > 
> > > X=BarIndex(); 
> > > p=Param("p",5,5,30,5);
> > > z=Zig(C,p);Plot(C,"C",1,64);
> > > CONDP=PeakBars(C,P)==0;SP=Cum(CONDP);
> > > EP1=ValueWhen(CONDP,C,1);TP1=ValueWhen(CONDP,X,1);  
> > > EP2=ValueWhen(CONDP,C,2);TP2=ValueWhen(CONDP,X,2); 
> > > EP3=ValueWhen(CONDP,C,3);TP3=ValueWhen(CONDP,X,3); 
> > > EP4=ValueWhen(CONDP,C,4);TP4=ValueWhen(CONDP,X,4); 
> > > CONDT=TroughBars(C,P)==0;ST=Cum(CONDT);
> > > ET1=ValueWhen(CONDT,C,1);TT1=ValueWhen(CONDT,X,1); 
> > > ET2=ValueWhen(CONDT,C,2);TT2=ValueWhen(CONDT,X,2); 
> > > ET3=ValueWhen(CONDT,C,3);TT3=ValueWhen(CONDT,X,3); 
> > > ET4=ValueWhen(CONDT,C,4);TT4=ValueWhen(CONDT,X,4); 
> > > ET5=ValueWhen(CONDT,C,5);TT5=ValueWhen(CONDT,X,5); 
> > > // EW definition
> > > EW8=EP3>EP4 AND EP2>EP3 AND EP2>EP1 AND ET4>ET5 AND ET3>ET2 AND 
> > > ET2>ET1 AND ET3>ET4 AND ET4>ET5 AND CONDT;
> > > COLOR=colorIndigo;
> > > PlotShapes(shapeDigit8*EW8,color);
> > > G=Cum(CONDP OR CONDT);
> > > GEW=SelectedValue(ValueWhen(EW8,G));
> > > PlotShapes(shapeDigit7*(G==GEW-1 AND CONDP),color, layer = 0, 
> > > yposition = Graph0, offset = 15  );
> > > PlotShapes(shapeDigit6*(G==GEW-2 AND CONDT),color);
> > > PlotShapes(shapeDigit5*(G==GEW-3 AND CONDP),color,layer = 0, 
> > > yposition = Graph0, offset = 15 );
> > > PlotShapes(shapeDigit4*(G==GEW-4 AND CONDT),color);
> > > PlotShapes(shapeDigit3*(G==GEW-5 AND CONDP),color,layer = 0, 
> > > yposition = Graph0, offset = 15 );
> > > PlotShapes(shapeDigit2*(G==GEW-6 AND CONDT),color);
> > > PlotShapes(shapeDigit1*(G==GEW-7 AND CONDP),color,layer = 0, 
> > > yposition = Graph0, offset = 15 );
> > > PlotShapes(shapeDigit0*(G==GEW-8 AND CONDT),color);
> > > Plot(EW8,"",colorPink,2+styleOwnScale);
> > > Plot(z,"",colorYellow,styleThick);
> > > Filter=EW8;// explore for all quotations
> > > AddColumn(C,"C");
> > > GraphXSpace=8;
> > > 
> > > a.
> > > The only change is in GEW line, instead of 
> > > GEW=LastValue(ValueWhen(EW8,G));
> > > I wrote
> > > GEW=SelectedValue(ValueWhen(EW8,G));
> > > b.
> > > The line ST=Cum(CONDT); counts the Troughs from the beginning 
of 
> > your 
> > > chart
> > > c.
> > > The line ST=Cum(CONDP); counts the respective Peaks
> > > d.
> > > The line G=Cum(CONDP OR CONDT); counts the angles of the yellow 
> zig 
> > > line, Peaks OR Troughs
> > > e.
> > > One [final] comment : My intension was to present some AFL 
> > > techniques, not to cover this [vast] EW story. I hope it was 
> clear 
> > > from the beginning.
> > > Dimitris Tsokakis
> > > --- In amibroker@xxxxxxxxxxxxxxx, "buzzmr" <buzzmr@xxxx> wrote:
> > > > Dimitris,
> > > > 
> > > > This is TERRIFIC!!  I SO much appreciate your helping me get 
> > > started 
> > > > with the prototype AFL implementation.  This kind of 
assistance 
> > is 
> > > > EXACTLY what I was seeking.  These latest additions are 
indeed 
> > > quite 
> > > > informative, and I can see the many ways I need to modify 
this 
> > > basic 
> > > > coding for my purposes, but at least now I'll be able to 
> continue 
> > > > where you've left off, so as to be able to cut, snip, 
> > add, 'tinker' 
> > > > and play to my heart's content.
> > > > 
> > > > This process has been a VERY EFFECTIVE and GREAT learning 
> > > experience 
> > > > for me!!  You're a wonderful 'teacher' AND facilitator, in 
> > addition 
> > > > to being a SUPERB programmer!!  (;->)  I am very grateful and 
> > can't 
> > > > thank you enough for your efforts.....
> > > > 
> > > > Take good care, be well, and have a MOST WONDERFUL evening 
and 
> > > GREAT 
> > > > weekend!!  (;->)
> > > > 
> > > > Buzz
> > > > 
> > > > P.S.  I was also able to retrieve the 'gif' image of your 
> charts 
> > > from 
> > > > the 'purebytes' site.  Thank you!
> > > > 
> > > > ---------------
> > > > 
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
> > > <TSOKAKIS@xxxx> 
> > > > wrote:
> > > > > Buzz,
> > > > > The EW patterns are complete on the pink bar.
> > > > > I added some digits [0 to 8] on the last pattern, to make 
> your 
> > > > study 
> > > > > easier .
> > > > > 
> > > > > X=BarIndex(); 
> > > > > p=Param("p",5,5,30,5);
> > > > > z=Zig(C,p);Plot(C,"C",1,64);
> > > > > CONDP=PeakBars(C,P)==0;SP=Cum(CONDP);
> > > > > EP1=ValueWhen(CONDP,C,1);TP1=ValueWhen(CONDP,X,1);  
> > > > > EP2=ValueWhen(CONDP,C,2);TP2=ValueWhen(CONDP,X,2); 
> > > > > EP3=ValueWhen(CONDP,C,3);TP3=ValueWhen(CONDP,X,3); 
> > > > > EP4=ValueWhen(CONDP,C,4);TP4=ValueWhen(CONDP,X,4); 
> > > > > CONDT=TroughBars(C,P)==0;ST=Cum(CONDT);
> > > > > ET1=ValueWhen(CONDT,C,1);TT1=ValueWhen(CONDT,X,1); 
> > > > > ET2=ValueWhen(CONDT,C,2);TT2=ValueWhen(CONDT,X,2); 
> > > > > ET3=ValueWhen(CONDT,C,3);TT3=ValueWhen(CONDT,X,3); 
> > > > > ET4=ValueWhen(CONDT,C,4);TT4=ValueWhen(CONDT,X,4); 
> > > > > ET5=ValueWhen(CONDT,C,5);TT5=ValueWhen(CONDT,X,5); 
> > > > > // EW definition
> > > > > EW8=EP3>EP4 AND EP2>EP3 AND EP2>EP1 AND ET4>ET5 AND ET3>ET2 
> AND 
> > > > > ET2>ET1 AND ET3>ET4 AND ET4>ET5 AND CONDT;
> > > > > COLOR=colorIndigo;
> > > > > PlotShapes(shapeDigit8*EW8,color);
> > > > > G=Cum(CONDP OR CONDT);
> > > > > GEW=LastValue(ValueWhen(EW8,G));
> > > > > PlotShapes(shapeDigit7*(G==GEW-1 AND CONDP),color, layer = 
0, 
> > > > > yposition = Graph0, offset = 15  );
> > > > > PlotShapes(shapeDigit6*(G==GEW-2 AND CONDT),color);
> > > > > PlotShapes(shapeDigit5*(G==GEW-3 AND CONDP),color,layer = 
0, 
> > > > > yposition = Graph0, offset = 15 );
> > > > > PlotShapes(shapeDigit4*(G==GEW-4 AND CONDT),color);
> > > > > PlotShapes(shapeDigit3*(G==GEW-5 AND CONDP),color,layer = 
0, 
> > > > > yposition = Graph0, offset = 15 );
> > > > > PlotShapes(shapeDigit2*(G==GEW-6 AND CONDT),color);
> > > > > PlotShapes(shapeDigit1*(G==GEW-7 AND CONDP),color,layer = 
0, 
> > > > > yposition = Graph0, offset = 15 );
> > > > > PlotShapes(shapeDigit0*(G==GEW-8 AND CONDT),color);
> > > > > Plot(EW8,"",colorPink,2+styleOwnScale);
> > > > > Plot(z,"",colorYellow,styleThick);
> > > > > Filter=EW8;// explore for all quotations
> > > > > AddColumn(C,"C");
> > > > > GraphXSpace=8; 
> > > > > 
> > > > > Dimitris Tsokakis
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis" 
> > > > <TSOKAKIS@xxxx> 
> > > > > wrote:
> > > > > > The following code will recognize a complete Elliot Wave 
> > > > [according 
> > > > > to http://www.equis.com/Education/TAAZ/?page=53 ]
> > > > > > sequence.
> > > > > > 
> > > > > > X=BarIndex(); 
> > > > > > p=Param("p",5,5,30,5);
> > > > > > z=Zig(C,p);
> > > > > > CONDP=PeakBars(C,P)==0;
> > > > > > E7=ValueWhen(CONDP,C,1);T7=ValueWhen(CONDP,X,1);
> > > > > > E5=ValueWhen(CONDP,C,2);T5=ValueWhen(CONDP,X,2);
> > > > > > E3=ValueWhen(CONDP,C,3);T3=ValueWhen(CONDP,X,3);
> > > > > > E1=ValueWhen(CONDP,C,4);T1=ValueWhen(CONDP,X,4);
> > > > > > CONDT=TroughBars(C,P)==0;
> > > > > > E8=ValueWhen(CONDT,C,1);T8=ValueWhen(CONDT,X,1);
> > > > > > E6=ValueWhen(CONDT,C,2);T6=ValueWhen(CONDT,X,2);
> > > > > > E4=ValueWhen(CONDT,C,3);T4=ValueWhen(CONDT,X,3);
> > > > > > E2=ValueWhen(CONDT,C,4);T2=ValueWhen(CONDT,X,4);
> > > > > > E0=ValueWhen(CONDT,C,5);T0=ValueWhen(CONDT,X,5);
> > > > > > // EW definition
> > > > > > EW=E5>E3 AND E3>E1 AND E5>E7 AND E4>E2 AND E2>E0 AND 
E6>E8 
> > AND 
> > > > > T8>T7 AND CONDT;
> > > > > > Plot(C,"C",1,64);
> > > > > > Plot(z,"",colorYellow,styleThick);
> > > > > > //PlotShapes(shapeDownArrow*CONDP,colorRed);
> > > > > > PlotShapes(shapeUpTriangle*EW,colorBlue);
> > > > > > //PlotShapes(shapeUpArrow*CONDT,colorBrightGreen);
> > > > > > Plot(EW ,"",colorPink,2+styleOwnScale);
> > > > > > Filter=EW;// explore for all quotations
> > > > > > AddColumn(C,"C");
> > > > > > GraphXSpace=8;
> > > > > > 
> > > > > > A blue triangle and a pink bar will indicate the 8th EW 
> point.
> > > > > > [The signs will be placed in the graph as soon as trough 
E8 
> > is 
> > > > > recognized as a trough. ]
> > > > > > I hope it will give a starting point for further analysis.
> > > > > > Dimitris Tsokakis
> > > > > > 
> > > > > > PS1. A 4-year pattern was completed on Oct1998, [p=15, 
> ^NDX], 
> > > > > before the big movement 
> > > > > > PS2. A 6-year pattern was completed on Sept2001,  [p=15, 
> > > ^GDAXI]. 
> > > > > The expectation [at E5] of an EW behavior
> > > > > > for DAX would be quite profitable.
> > > > > > 
> > > > > > ----- Original Message ----- 
> > > > > > From: Dimitris Tsokakis 
> > > > > > To: amibroker@xxxxxxxxxxxxxxx 
> > > > > > Sent: Friday, June 18, 2004 11:17 AM
> > > > > > Subject: The Elliot Waves
> > > > > > 
> > > > > > 
> > > > > > In
> > > > > > 
> http://finance.groups.yahoo.com/group/amibroker/message/65542
> > > > > > Buzz wrote, among the others
> > > > > > "I simply wanted some direction to help me determine
> > > > > > if 'the wheel had been already invented' using AFL ..OR.. 
> if 
> > > there
> > > > > > are some coding suggestions, OR cautions, when using AFL 
for
> > > > > > programming AB to do the specific job of E.W.-candidate 
> > > > PRELIMINARY
> > > > > > SCREENING --- that's all. In this regard, Dimitris's 
> > commentary 
> > > > has
> > > > > > been MOST helpful and useful, and I see I have to do 
> > > > more 'homework'
> > > > > > regarding defining the process and then implementing the
> > > > > > coding."
> > > > > > Buzz,
> > > > > > Let us be creative.
> > > > > > We will  code EW if we have a clear definition of EW. 
> > > > > > Else, we will talk till June 2014 [or more] and, to be 
> > honest, 
> > > I 
> > > > > have better things to do.[suppose the same for you]
> > > > > > Let us see the first http://www.equis.com/Education/TAAZ/?
> > > page=53
> > > > > > chart.
> > > > > > Do we agree that
> > > > > > 01. E0, E2, E4, E6 and E8 are troughs
> > > > > > 02. E1, E3, E5 and E7 are peaks 
> > > > > > 11. E5>E3>E1
> > > > > > 12. E4>E2>E0
> > > > > > 13. E5>E7
> > > > > > 14. E6>E8
> > > > > > 15. E5>E7
> > > > > > 16. point E8 is *after* point E7
> > > > > > 
> > > > > > If positive, the AFL code is coming from the corner.
> > > > > > If your interpretation for EW sequence is different, 
please 
> > > > advise 
> > > > > *before* the code.
> > > > > > Dimitris Tsokakis



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/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/