Why not do 2 separate loops and in the first use varset to obtain what information you need for each signal to use in the second loop
-- Cheers Graham Kav AFL Writing Service http://www.aflwriting.com On 16/11/2007, david.weilmuenster <[EMAIL PROTECTED]> wrote: > GP, > > Thanks. I was afraid it would involve something similar to your > suggestion. > > Will take it from there, and make something work. > > Thanks agin, > David > > > --- In [email protected], "gp_sydney" <[EMAIL PROTECTED]> > wrote: > > > > Yes, the backtester object maintains the state internally of which > > signal is the next one, so both loops are affecting the same state > > variable. > > > > For the outer loop you need to keep your own count of how many > signals > > it's processed and after the inner loop has finished, do another get > > first followed by the current count of get next until the state is > > back to where it needs to be for the next pass of the outer loop. > > > > There are a few ways to do this, but one would be something like > this: > > > > sig = bo.GetFirstSignal(bar); > > count = 1; > > while (sig) > > { > > ... inner loop here ... > > > > sig = bo.GetFirstSignal(bar); > > cnt = count++; > > while (sig && cnt--) sig = bo.GetNextSignal(bar); > > } > > > > I haven't tried this code though, so there may be issues in it. > > > > Note also that the way you have it, the outer loop will terminate at > > the very first signal that's not an entry. If you only want to skip > > non-entries rather than terminate the loop at the first one, put the > > IsEntry test inside the loop in an IF statement, not as part of the > > loop condition. Similarly for the inner loop with the symbol match > test. > > > > Regards, > > GP > > > > > > --- In [email protected], "david.weilmuenster" > > <dweilmuenster95125@> wrote: > > > > > > Hi, > > > > > > Is it possible to use nested loops of Signals in Custom > BackTester? > > > > > > What I have in mind is something like: > > > > > > for ( sig = bo.GetFirstSignal(bar); sig AND sig.isentry; > > > sig=bo.GetNextSignal(bar)) > > > { > > > ... > > > > > > for ( compsig = bo.GetFirstSignal(bar); compsig AND > compsig.symbol != > > > sig.symbol; compsig=bo.GetNextSignal(bar)) > > > { > > > > > > .... > > > > > > } > > > } > > > > > > But, what seems to happen is that the inner loop is processed > only > > > once, for the first signal identified in the outer loop. Am > guessing > > > that bo.getnextsignal(bar) needs to be "reset" somehow at end of > > > inner loop, but don't see how to do it. > > > > > > > > > Thanks in advance for help, > > > > > > David > > > San Jose, CA > > > > > > > > > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > > Yahoo! Groups Links > > > >
