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 <[EMAIL PROTECTED]> wrote:
>
>  I believe in IF statements that you need
>
>
>
> && for AND … and
>
> || for OR …
>
>
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *lifes_student_1
> *Sent:* Sunday, August 26, 2007 5:01 PM
> *To:* [email protected]
> *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 [email protected] <amibroker%40yahoogroups.com>, Fred
> Tonetti <[EMAIL PROTECTED]> wrote:
> >
> > break;
> >
> >
> >
> > Requires 4.91 or above.
> >
> >
> >
> > See the current ReadMe
> >
> >
> >
> > _____
> >
> > From: [email protected] <amibroker%40yahoogroups.com> [mailto:
> [email protected] <amibroker%40yahoogroups.com>]
> On Behalf
> > Of lifes_student_1
> > Sent: Sunday, August 26, 2007 4:31 PM
> > To: [email protected] <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!
> 
>

Reply via email to