PureBytes Links
Trading Reference Links
|
Dear Tomasz
I have a question on the way the AFL and VBScript
behave.
I understand that the AFL script has been designed
in order to shorten as much as possible the calculations on stocks
values.
That is when we have an AFL script
like
buy = cross (macd(), 0);sell = cross ( 0,
macd());
buy = exrem( buy, sell);sell = exrem (sell,
buy);
BuyPrice = ValueWhen( buy, C, 1);SellPrice =
ValueWhen( sell, C, 1);
ProfitRatio = IIF(Sell, SellPrice /
BuyPrice, 0);
I understand that this code is run line by
line for each bar.
When we introduce a VBScript or JScript after the
AFL code like :
<%PP = AFL.Var("ProfitRatio")msgbox
ubound(PP)CPP = PPCPP(0) = 1For i = 1 to 4 CPP(i) = (
PP(i-1) * PP(i) -1 ) *100Next
AFL.Var("CPP") = CPP%>
I thought that the this code was also running for
each bar and if there is a For ... Next lines, they will by calculated for each
bar as well.
But if I put a MsgBox(ubound(PP)) atthe
begining of the VBScript I have only one message with already the total
number.
So it seams that AFL code is used for eachbar and
VBScript only at the end !
Is it correct and is it still true if we
have several portions of AFL and VBScript mixed ?
Regards
Bernard Bourée<A
href="">bernard@xxxx
|