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

Re: vbscript help.



PureBytes Links

Trading Reference Links

Hi - 

have just been through this pain, and I now understand it. Please 
tell me the specific problem you are having with your loop, and I may 
be able to help.

Is it type mismatch or out of range?

e-mail me privately if you choose.

--- In amibroker@xxxx, "amiabilityy" <amiabilityy@xxxx> wrote:
> hello,
> 
> I am having trouble trying to do a loop.
> 
> what i am trying to do is .
> 
> after the first time that HHV(H,10) is true then create a 
channel 
> which would be the value of the high + %5 and the high - %5.
> 
> if the high crosses the top %5 channel then the high creates a new 
> channel on this high using the same %5 rules on that high.
> but if the low crosses below the low %5 channel then a channel of 
> that low +%5 and the low - %5 will be created on that low which 
ever 
> is true first.
> the HHV(h,10) is only used once to form the first channel, 
then 
> the other rules apply. 
> 
> 
> I have tried using a few examples of vbscript, this vbscript 
below 
> was posted by Herman van den Bergen, and it was a reply about 
> looping, but it doesnt seem to do what i want.
> 
> I have recently purchased a book on VBscript but am still non 
the 
> wiser.
> 
> 
> // you can put other AFL code here
> 
> EnableScript("vbscript");
> <% 'Start of VB script
> Open = AFL("Open") 'This is how you tell VB Open is an array
> Open2 = AFL("OI") 'This is how you declare other arrays you need
> FOR i = 1 to UBound( Open ) 'This creates a loop from bar 1 to the 
end
> Open2(i) = Open(i) + 1 'This is where you do your work that requires
> looping
> 'This dummy statement just adds 1 to the open
> price
> Next 'End of loop
> AFL("Open2") = Open2 'Pass arrays back to AFL
> %> 'End of VB script
> 
> // more AFL code
> Plot(Open,"Open",4,1); //Check the results in AFL
> Plot(Open2,"Open2",1,1);
> 
> 
> peter.