[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


guys from memory it was jonf who wrote the 
Darvas code  :)
 
David
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A title=nenapacwanfr@xxxx 
href="">nenapacwanfr 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Saturday, April 27, 2002 7:48 
PM
Subject: [amibroker] Re: jscript & 
vbScript inside indicator builder

Dimitri,I am not the author of the jscript code, But I don't 
remember who has written it.I give it only because I'll try to write 
it as a plugin dll as an exercise to write a pattern dll in the next 
future. stephane> 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