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

[amibroker] Re: Nested Loops to Examine Signals in Custom BackTester



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@xxx> 
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 amibroker@xxxxxxxxxxxxxxx, "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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/