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

SetVar problem



PureBytes Links

Trading Reference Links


Hello Tomasz  and Dimitris,
 
My exploration is progressing.
But I still have a problem.
I have an error "SetVar not 
successful"
I guess it is a problem between AFL and VBScript 
variable.
Can you tell me where is my mistake ?
 
Thanks
 
 
/* TS TEST */
 
EnableScript("VBScript");buy = cross(macd(), 
0);LastBuy  = BarsSince(buy);sell = IIF(LastBuy, cross ( 0, 
macd()), 0);
 
buy = exrem( buy, sell);sell = exrem (sell, 
buy);
 
Position = iif(buy, 1, iif( sell, -1, 
0));BuyPrice = ValueWhen( buy, C, 1);SellPrice = ValueWhen( sell, C, 
1);
 
/* PositionProfit = IIF( Sell, SellPrice- 
BuyPrice, 0); *//* Does not seams to work */PositionProfit = IIF(Sell, 
SellPrice - BuyPrice, 0);ProfitRatio = IIF(Sell, SellPrice  /  
BuyPrice, 0);LastSell = BarsSince(Sell);
 
<%PP = AFL.Var("ProfitRatio")Dim 
CPP()Nb = Ubound(PP)ReDim CPP( Nb)CPP(0) = 0For i = 1to 
Ubound(PP) CPP(i) = ( PP(i) * PP(i-1) -1 ) *100Next 
AFL.Var("CompPercentProfit") = CPP%>
 
ETop = Highest(CompPercentProfit);TopBar = 
HighestBars(CompPercentProfit);
 
EBot = IIf( Etop > Ref(ETop, -1), ETop, 
Lowest(CompPercentProfit));BotBar = LowestBars(CompPercentProfit);TopInt 
= Cum(1) - TopBar;BotInt = Cum(1) - BotBar;EDraw = CompPercentProfit / 
ETop;
 
filter = buy or sell;
 
numcolumns = 11;column0 = 
position;column0Name ="Pos.";column1= buyprice;column1Name = "Buy 
p.";column2 = sellprice;column2Name = "Sell P.";column3 = 
PositionProfit;column3Name = "PosProfit";column3Format = 1.3;column4 
=ProfitRatio;column4Format = 1.3;column4Name = "Profit R";column5 = 
CompPercentProfit;column5Format = 1.2;column5Name = 
"Comp%Prof";column6Format = 1.2;column6 = ETop;column6Name = 
"ETop";column7 = EBot;column7Name = "EBot";column7Format = 
1.2;column8 = TopInt;column8Name = "TopInt";column8Format = 
1.2;column9 = BotInt;column9Name = "BotInt";column9Format = 
1.2;column10 = EDraw;column10Name = "EDraw";column10Format = 
1.2;
Bernard Bourée<A 
href="">bernard@xxxx