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

Re: [amibroker] Exploration AFL is causing AB to throw and exception



PureBytes Links

Trading Reference Links

Thanks Graham!

I'll give that a shot.

Kind regards,
                                      Nick

On Mon, 5 Mar 2007, Graham wrote:

> not sure if this will help but if the values are not available for all
> symbols in the range as Tj suggested you might find it easier to just
> use the NZ function and remove the IF part
> 
> Pct_Change = nz(100.0 * ( Ci - Cf )/ Ci);
> C1 = Pct_Change > 0.5;
> C2 = Ci > 2 AND Cf > 2;
> C3 = nz(Vi) > 100000;
> 
> -- 
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://www.aflwriting.com
> 
> 
> On 05/03/07, Tomasz Janeczko <groups@xxxxxxxxxxxxx> wrote:
> > BTW: next maintenance update will have it fixed.
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: "Tomasz Janeczko" <groups@xxxxxxxxxxxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Monday, March 05, 2007 1:22 AM
> > Subject: Re: [amibroker] Exploration AFL is causing AB to throw and exception
> >
> >
> > > Hello,
> > >
> > > Scalars works fine in AddColumn, at least on my end.
> > > There should be no problem with using scalars as they are automatically
> > > upsized to arrays when needed.
> > >
> > > Simple check:
> > >
> > > Filter=1;
> > > AddColumn(1,"test"); // scalars work fine
> > >
> > >
> > > What may have give problems is that when your data consists of unlisted
> > > symbols that don't have data for range begin and/or end.
> > >
> > > I prepared artificial data that simulates symbol that stopped tradin in 1999
> > > and when I run your formula with range selected in 2006 it generates exception.
> > >
> > > Workaround is to exclude unlisted symbols from the exploration.
> > > You may use Tools->Database Purify to detect such symbols
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message -----
> > > From: "Nick Busigin" <nick@xxxxxxxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Monday, March 05, 2007 1:09 AM
> > > Subject: Re: [amibroker] Exploration AFL is causing AB to throw and exception
> > >
> > >
> > >> Hi Tomasz,
> > >>
> > >> Thanks for you quick reply...
> > >>
> > >> FWIW, I put the AddColumn statements inside the if statement in a
> > >> misguided attempt to eliminate the problem I was seeing.  Per your
> > >> suggestion, I got rid of the if{} around the AddColumn() statements, but
> > >> still have problems and AB is still throwing an exception.
> > >>
> > >> Upon studying the manual some more, I discovered an error in my code
> > >> which I think is the root of my problem.  ie. I am using a scalar
> > >> variable as the first argument in one of the AddColumn()  statements
> > >> instead of an array variable.  However, I do want to print out the
> > >> scalar variable Pct_Change in the report.  Is there a way to convert the
> > >> scalar Pct_Change variable into an array so I can use it in the
> > >> AddColumn() function?
> > >>
> > >> Kind regards,
> > >>                                    Nick
> > >>
> > >> Here's my revised program which unfortunately still crashes AB:
> > >>
> > >> ---- Script begins after this line -----
> > >> /*
> > >> * Scan for stocks in an Interval that have:
> > >> *
> > >> *  - a higher Close at the end of the interval than at the beginning of
> > >> *    the interval
> > >> *  - a price higher than 2
> > >> *  - a volume higher than 100,000 (based on bar at the beginning of the
> > >> *    interval)
> > >> *
> > >> * NOTE:  YOU MUST SET THE BEGIN AND END MARKERS ON THE CHART BEFORE
> > >> *        RUNNING THIS EXPLORATION.
> > >> */
> > >>
> > >> Ci = BeginValue(C);
> > >> Cf = EndValue(C);
> > >> Vi = BeginValue(V);
> > >> Pct_Change  = 0;
> > >>
> > >> if (Ci != 0)
> > >>   Pct_Change = 100.0 * ( Ci - Cf )/ Ci;
> > >>
> > >> C1 = (Pct_Change > 0.5);
> > >> C2 = (Ci > 2) AND (Cf > 2);
> > >> C3 = (Vi > 100000);
> > >>
> > >> Filter = C1 AND C2 AND C3;
> > >>
> > >> AddColumn( C, "Close" );
> > >> AddColumn( Pct_Change, "Pct Change" );
> > >> AddColumn( V, "Volume" );
> > >> ---- Script ends before this line -----
--



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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/