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

[amibroker] Re: break out of loop?



PureBytes Links

Trading Reference Links

You can download DebugView from Microsoft (free) here:
  
http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx

Refer to the AFL Language Ref for the _TRACE function for how to use 
it:

  http://www.amibroker.com/guide/afl/afl_view.php?id=222

You may want to customize your AmiBroker "Tools" menu to include 
DebugView once you've got it installed.

--- In amibroker@xxxxxxxxxxxxxxx, "lifes_student_1" <suedeuno@xxx> 
wrote:
>
> Um, where is DebugView?
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@> 
> wrote:
> >
> > That should not be the case, so I would guess that the values 
you're
> > getting are not what you think.
> > 
> > After Graham's line below, try adding this:
> > 
> > dt = DateTime();
> > for (i = 0; i < BarCount; i++)
> > {
> >     if (trigger[i])
> >         _TRACE(DateTimeToStr(dt[i])+StrFormat(": i = %1.0f, 
trigger 
> =
> > %1.0f, bbarsback = %1.0f, triggerbar = %1.0f", i, trigger[i],
> > bbarsback[i], triggerbar));
> > }
> > 
> > (that _TRACE statement should all be on a single line)
> > 
> > then run DebugView and run the script. See if any lines in the 
debug
> > output show bbarsback greater than triggerbar.
> > 
> > Regards,
> > GP
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "lifes_student_1" <suedeuno@> 
> wrote:
> > >
> > > That would make more sense, however that doesn't work ether. It 
> is 
> > > still giving me true case when bbarsback was 8 bars ago. I took 
> out 
> > > the loop and just used the example you gave me. 
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@> wrote:
> > > >
> > > > Is this what you are after?
> > > > 
> > > > trigger = bbarsback < triggerbar AND sbarsback > bbarsback;
> > > > 
> > > > -- 
> > > > Cheers
> > > > Graham Kav
> > > > AFL Writing Service
> > > > http://www.aflwriting.com
> > > > 
> > > > 
> > > > 
> > > > On 27/08/07, gp_sydney <gp.investment@> wrote:
> > > > > If triggerbar is 5 and bbarsback is BarsSince(bcondition), 
> then 
> > > this
> > > > > should not give a true result if bcondition has not 
occurred 
> in 
> > > the
> > > > > last 5 bars.
> > > > >
> > > > > GP
> > > > >
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "lifes_student_1" 
> <suedeuno@> 
> > > wrote:
> > > > > >
> > > > > > trigger = bbarsback < triggerbar AND sbarsback > 
triggerbar;
> > > > > >
> > > > > > still doesn't give me the proper trigger. I should only 
get 
> a 
> > > true
> > > > > > case if less than 5 bars since signal is true. RIght now 
> the 
> > > case is
> > > > > > returning true when barssince is greater or lesser.
> > > > > >
> > > > > >
> > > > > >
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@> 
> wrote:
> > > > > > >
> > > > > > > You are only calculating over the first 301 bars of the 
> > > history, ie
> > > > > > > barindex() from 0 to 300
> > > > > > > To use this properly you need to use the loop over the 
> full 
> > > array
> > > > > > length and
> > > > > > > then each bar needs to work backwards using z
> > > > > > > also use trigger[i] = True to define it as array
> > > > > > >
> > > > > > > other than that as already mentioned in other thread 
you 
> do 
> > > not need
> > > > > > a loop
> > > > > > > at all
> > > > > > > trigger = bbarsback < triggerbar AND sbarsback > 
> triggerbar;
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Cheers
> > > > > > > Graham Kav
> > > > > > > AFL Writing Service
> > > > > > > http://www.aflwriting.com
> > > > > > >
> > > > > > >
> > > > > > > On 27/08/07, Fred Tonetti <ftonetti@> wrote:
> > > > > > > >
> > > > > > > >  I believe in IF statements that you need
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > && for AND ? and
> > > > > > > >
> > > > > > > > || for OR ?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >  ------------------------------
> > > > > > > >
> > > > > > > > *From:* amibroker@xxxxxxxxxxxxxxx
> > > > > > [mailto:amibroker@xxxxxxxxxxxxxxx] *On
> > > > > > > > Behalf Of *lifes_student_1
> > > > > > > > *Sent:* Sunday, August 26, 2007 5:01 PM
> > > > > > > > *To:* amibroker@xxxxxxxxxxxxxxx
> > > > > > > > *Subject:* [amibroker] Re: break out of loop?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > trying to lookback and find a signal to trigger 
whether 
> to 
> > > use
> > > > > > > > subsequent signals and it's not giving me the desired 
> > > results of
> > > > > only
> > > > > > > > setting trigger to true when a signal (bbarsback[i] <
> > > > > triggerbar) and
> > > > > > > > (sbarsback > triggerbar). What is happening is it is 
> > > plotting the
> > > > > > > > colors regardless of when the triggerbar occurred, 
but 
> I 
> > > only
> > > > > want to
> > > > > > > > plot green when bcondition occurred within the last 5 
> days 
> > > and
> > > > > > > > scondition has not occurred since bcondition. Make 
> sense?
> > > > > > > >
> > > > > > > > triggerbar = Param("TriggerBar", 6, 1, 50, 1, 0);
> > > > > > > > trigger = False;
> > > > > > > > bbarsback = BarsSince(bcondition1 == True);
> > > > > > > > sbarsback = BarsSince(scondition1 == True);
> > > > > > > >
> > > > > > > > for(z=0;z<300;z++)
> > > > > > > > {
> > > > > > > > if(bbarsback[z] < triggerbar AND sbarsback[z] > 
> triggerbar)
> > > > > > > > {
> > > > > > > > if(sbarsback[z] > triggerbar)
> > > > > > > > {
> > > > > > > > trigger = True;
> > > > > > > > }
> > > > > > > > }
> > > > > > > > }
> > > > > > > >
> > > > > > > > result = (trigger AND C1 AND C2) AND (C3 == 1 OR C4 
> ==1);
> > > > > > > >
> > > > > > > > isignal = IIf(result, colorGreen, colorRed);
> > > > > > > > Plot
> > > (1,"Test",isignal,styleOwnScale|styleArea|styleNoLabel,0,0,0);
> > > > > > > >
> > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%
> > > 40yahoogroups.com>, Fred
> > > > > > > > Tonetti <ftonetti@> wrote:
> > > > > > > > >
> > > > > > > > > break;
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Requires 4.91 or above.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > See the current ReadMe
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > _____
> > > > > > > > >
> > > > > > > > > From: amibroker@xxxxxxxxxxxxxxx <amibroker%
> > > 40yahoogroups.com>
> > > > > > [mailto:
> > > > > > > > amibroker@xxxxxxxxxxxxxxx <amibroker%
40yahoogroups.com>]
> > > > > > > > On Behalf
> > > > > > > > > Of lifes_student_1
> > > > > > > > > Sent: Sunday, August 26, 2007 4:31 PM
> > > > > > > > > To: amibroker@xxxxxxxxxxxxxxx <amibroker%
> > > 40yahoogroups.com>
> > > > > > > > > Subject: [amibroker] break out of loop?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > say I have a loop setting a variable and break if 
set:
> > > > > > > > >
> > > > > > > > > for(i=0;i<barsback;i++)
> > > > > > > > > {
> > > > > > > > > if(something)
> > > > > > > > > {
> > > > > > > > > variable = true;
> > > > > > > > > //break if true;
> > > > > > > > > }
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > _____
> > > > > > > > >
> > > > > > > > > I am using the free version of SPAMfighter for 
> private 
> > > users.
> > > > > > > > > It has removed 43 spam emails to date.
> > > > > > > > > Paying users do not have this message in their 
emails.
> > > > > > > > > Try SPAMfighter <http://www.spamfighter.com/len> 
for 
> free 
> > > now!
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > ------------------------------
> > > > > > > > I am using the free version of SPAMfighter for 
private 
> > > users.
> > > > > > > > It has removed 43 spam emails to date.
> > > > > > > > Paying users do not have this message in their emails.
> > > > > > > > Try SPAMfighter <http://www.spamfighter.com/len> for 
> free 
> > > now!
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 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
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>




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/