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

[amibroker] Re: AFL - Translatin TS code



PureBytes Links

Trading Reference Links

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



> I looked on the Amibroker site+third party site, and in the files 
sections
> of this groups but i could not find anything under  Darvas Box-- 
could
> someone please point me in the right direction...
> 
> and then my next question is---how do i install it?
> do i use the Tools/Plugins, highlight it and click Load?  i assume 
it stays
> loaded.
> Will this then appear as default when i load AB, in the Price 
chart, or will
> it have a separate window?
> 
> thanks,
> ron
> 
> -----Original Message-----
> From: Stephane Carrasset [mailto:nenapacwanfr@x...]
> Sent: Monday, February 09, 2004 12:37 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Darvas Box
> 
> 
> 
> 
> > > Hi Stephane,
> > >
> > > Thank you for your code and explanation. In your email, you
> > mentioned the
> > > example about source code, is this available anywhere for
> download ?
> 
> I just come to upload it in the file section of amibroker dll group
> 
> stephane
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.592 / Virus Database: 375 - Release Date: 2/18/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/