PureBytes Links
Trading Reference Links
|
Thanks for (reposting) the Darvas box code and our compliments to
Stephane for the nice programming.
May I suggest that the last 2 code lines can better be replaced by:
Plot( box1, "" , colorRed, 512);
Plot( box2, "" , colorGreen , 512);
which gives "real" and nicer looking boxes
Another great Power Point slide show / tutorial can be found at
http://members.iinet.net.au/~bspark/slide_shows.htm (Darvas Boxes)
Fred
--- In amibroker@xxxxxxxxxxxxxxx, "ronbo" <ronbo@xxxx> wrote:
> This is code which Stephane posted on 2/23/2004. i hope it is what
you
> want...
> let us know if it works for you.
> ron
>
>
>
> The code in AFL for Darvas Box is below, everyone can change it to
> suit the conditions he wants
>
> stephane
>
>
> //////////begin/////////
>
> box1=0;
> box2=0;
>
> procedure fillDarvas(start,end,swap,top, bottom )
> {
> for ( j = start; j < end; j++)
> {
> if( box1[j] = swap)
> box1[j]= top ;
> else
> box1[j]= bottom;
>
> if(box2[j] = swap)
> box2[j]= bottom ;
> else
> box2[j]= top;
> }
> }
>
> BoxArr1 = 0;
> BoxArr2 = 0;
> StateArray = 0;
> DBuy = 0;
> DSell = 0;
> TopArray = 0;
> BotArray = 0;
> tick=0;
>
> BoxTop = High[0];
> BoxBot = Low[0];
> swap=0;
> state = 0;
> BoxStart = 0;
>
> for (i=0; i<BarCount; i++)
> {
> if (state==5)
> {
> TopArray[i]=BoxTop;
> BotArray[i]=BoxBot;
> if (Low[i]<(BoxBot*(1-tick/100)) || High[i]>(BoxTop*(1+tick/100)))
> {
> fillDarvas(BoxStart,i,swap,BoxTop,BoxBot);
>
> state = 1;
> swap = !swap;
> BoxTop = High[i];
> BoxStart = i;
> }
> }
> else
> {
> if (High[i]<BoxTop)
> {
> if ((state<3) || (Low[i]>BoxBot))
> {
> state++;
> }
> else
> {
> state=3;
> }
> if (state==3)
> BoxBot=Low[i];
> }
> else
> {
> state=1;
> BoxTop=High[i];
> }
> }
> StateArray[i] = state;
> }
>
> fillDarvas(BoxStart,BarCount,swap,BoxTop,BoxBot);
>
> Plot(C,"",1,64);
> Plot( box1, "" , colorRed, styleLine );
> Plot( box2, "" , colorGreen , styleLine );
>
>
> ///////////end///////////////////
>
>
> -----Original Message-----
> From: Pras [mailto:pgnayak@x...]
> Sent: Saturday, April 03, 2004 10:15 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Darvas boxes.
>
>
> HI,
>
> I am new to this group and am also posting for the 1st time.
>
> I have read about darvas boxes and also seen them wrkg for
metastock,
> but as said by several poeple and also my personal opinion,
Amibroker
> is a versatile program to use and more friendly then metastock.
>
> Can this boxes be drawn in amibroker also ? can experts guide me on
> this.
>
> Pras
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.642 / Virus Database: 410 - Release Date: 3/24/2004
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/
|