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

Re: [amibroker] Re: jscript & vbScript inside indicator builder



PureBytes Links

Trading Reference Links


DT if you search back through the egroup for Darvas 
you will find a reference to the site where state was used to calculate the 
Darvas system ..
 
message below has a link to site I believed was 
used to help right the formula
<A 
href="">http://groups.yahoo.com/group/amibroker/message/10740
 
 
Regards David
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
dtsokakis 

To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Saturday, April 27, 2002 6:45 
PM
Subject: [amibroker] Re: jscript & 
vbScript inside indicator builder

Stephane,What a nice example. Thank you.How about apply it to 
indicators ?A first attempt 
:X=StochD();L=LLV(X,3);H=HHV(X,5);C=MA(X,3);O=C;EnableScript ( 
"jscript" );<%Low   = VBArray( AFL ("L" ) 
).toArray();High  = VBArray( AFL ("H") ).toArray();boxTopArr = 
new Array(); boxBotArr = new Array();stateArr  = new Array(); 
state  = stateArr[0] = 1;  boxStart = 0; boxTop = High[0]; 
boxBot = 0; swap=0;for (i=1; i<Low.length; i++) {   if 
(state==5) {      if (boxBot>Low[i] || 
boxTop<High[i]) {         for 
(j=boxStart; j<i; j++) 
{            
boxTopArr[j] = swap ? boxTop : 
boxBot;            
boxBotArr[j] = swap ? boxBot : boxTop; 
            
}         state = 1; swap = !swap; 
         boxTop = High[i]; 
boxStart = i;         
}      }   else if 
(boxTop>High[i]) {      if ((state<3) || 
(boxBot<Low[i]) )  state++;      
else                                
state=3;      if (state==3) 
boxBot=Low[i];      }   else{ 
      state=1; boxTop=High[i]; }   
stateArr[i] = state;   }for (j=boxStart; 
j<Low.length; j++) {    boxTopArr[j] = swap ? boxTop : 
boxBot;    boxBotArr[j] = swap ? boxBot : boxTop; 
    }AFL.Var("boxTop") = 
boxTopArr;AFL.Var("boxBot") = boxBotArr; AFL.Var("state") = 
stateArr;%>Plot(C, "", 1, 128);// plot(state, "", 2, 
1);Plot(boxTop, "top", state+1,512);Plot(boxBot, "bot", 
state+1,512);Title= "DarvaBox for:"+Name() +" 
state("+WriteVal(state,1)+")"      +" 
Bottom:"+WriteVal(Max(boxTop,boxBot), 1.2)      
+" Top:"+WriteVal(Min(boxBot,boxTop),1.2);If you use this technique, what 
is the trading meaning of "states" and the respective colours 
?Dimitris Tsokakis--- In amibroker@xxxx, "nenapacwanfr" 
<nenapacwanfr@xxxx> wrote:> yes you can, example;> 
> EnableScript ( "jscript" );> <%> Low   = 
VBArray( AFL ("L" ) ).toArray();> High  = VBArray( AFL ("H") 
).toArray();> boxTopArr = new Array(); boxBotArr = new Array();> 
stateArr  = new Array(); > state  = stateArr[0] = 1;  
boxStart = 0; > boxTop = High[0]; boxBot = 0; 
swap=0;>   > for (i=1; i<Low.length; i++) 
{>    if (state==5) 
{>       if (boxBot>Low[i] || 
boxTop<High[i]) 
{>          for 
(j=boxStart; j<i; j++) 
{>             
boxTopArr[j] = swap ? boxTop : 
boxBot;>             
boxBotArr[j] = swap ? boxBot : boxTop; 
>             
}>          state =1; 
swap = !swap; >          
boxTop = High[i]; boxStart = 
i;>          
}>       }>   else 
if (boxTop>High[i]) {>       if 
((state<3) || (boxBot<Low[i]) )  
state++;>       
else                                
state=3;>       if (state==3) 
boxBot=Low[i];>       
}>    else { 
>       state=1; boxTop=High[i]; 
}>    stateArr[i] = state;>    
}>  > for (j=boxStart; j<Low.length; j++) 
{>     boxTopArr[j] = swap ? boxTop : 
boxBot;>     boxBotArr[j] = swap ? boxBot : boxTop; 
>     }>  > AFL.Var("boxTop") = 
boxTopArr;> AFL.Var("boxBot") = boxBotArr; > AFL.Var("state") = 
stateArr;> %>>  > Plot(C, "", 1, 128);> // 
plot(state, "", 2, 1);> Plot(boxTop, "top", state+1,512);> 
Plot(boxBot, "bot", state+1,512);>  > Title= "DarvaBox 
for:"+Name() +" 
state("+WriteVal(state,1)+")">      +" 
Bottom:"+WriteVal(Max(boxTop,boxBot), 
1.2)>       +" 
Top:"+WriteVal(Min(boxBot,boxTop),1.2);>  > > > 
> Does anyone know if AB allows jscript/vbscript/c++> > inside 
indicator builder? It seems to work only in> > Automatic Analysis 
but not in Indicator builder.  > > > > 
Thanks.> > > > 
__________________________________________________> > Do You 
Yahoo!?> > Yahoo! Health - your guide to health and wellness> 
> <A 
href="">http://health.yahoo.comYour 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 

<BLOCKQUOTE 
><FONT 
face="Courier New">---Outgoing mail is certified Virus 
Free.Checked by AVG anti-virus system (<A 
href="">http://www.grisoft.com).Version: 6.0.351 
/ Virus Database: 197 - Release Date: 
4/19/2002