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

Re: jscript & vbScript inside indicator builder



PureBytes Links

Trading Reference Links

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
> http://health.yahoo.com